CLIxIndia-Dev / CLIxIndia-Dev/MiTiRobot

Form validation in the Admin tool, for the Element fields

Open
#1 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

In the `README`, it says that the Element text must start with `start`, for Telegram to parse things correctly. I would recommend actually enforcing this in the form, rather than rely on human authors / process. You can do this with a custom form validation. See references below:

https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#admin-custom-validation
https://docs.djangoproject.com/en/1.11/ref/forms/validation/
https://docs.djangoproject.com/en/dev/ref/validators/#writing-validators
https://stackoverflow.com/questions/12608639/django-field-validation-in-model-and-in-admin
https://stackoverflow.com/questions/24802244/custom-validation-in-django-admin

So something like `value.startswith('start')` would work?

And writing a test for that would be great...to verify the validator works as expected.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README requirement that Element text begins with `start`, then follow the Django admin and form-validation references to locate the Element form or validator. Add a validator and a test covering valid and invalid values; done means the admin rejects values without the required prefix.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.