My django model needs a field which should have input ,the integers 1 to 10.I modelled this as below
class Review(model):
...
rating = models.IntegerField(default=5,help_text='value 1 to 10')
I am providing forms for creating and editing a Review as below
class ReviewForm(ModelForm):
class Meta:
model=Review
...
class ReviewEditForm(ModelForm):
class Meta:
model=Review
....
What should I do to make sure that user inputs an integer 1 to 10 ..Should I check for this in clean method of forms ? Or is there a better way?
Ideally I want to show the field as a slider which is available in html5 (RangeInput I think),which shows as a slider in chrome and textfield in firefox16.0.2ubuntu.But I don’t know how this can be done without javascript
You could use django validators for the job