class Foods(models.Model):

 


 

 def __str__(self): 

 return self.name 


 

 name = models.CharField(max_length=200) 

 quantity = models.PositiveSmallIntegerField(default=1, validators=[ 

 MinValueValidator(1)]) 

 quandesc = models.CharField(max_length=3, choices=(('Item', 'Qty'), 

 ('Kilo', 'Kg.'), ('Litr', 'L.')), default='Item') 

 comment = models.TextField(blank=True) 

 to_ods = models.BooleanField(default=False) 

 to_email = models.BooleanField(default=False) 

 foodlist = models.ManyToManyField('FoodList')




пятница, 1 апреля 2016 г., 11:46:42 UTC+3 пользователь Denis Makarov 
написал:
>
> On the server-side I use validators for controlling valid values.
>
> But if I use TextInput, such:
>
> 'quantity': TextInput(attrs={'min': 1}),
>
> It works fine in html source code.
>
> Full source code you can find below:
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/921a4755-b698-41d5-810c-cdcac21f2923%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to