Django doesn't validate models automatically. You can validate model manually as per docs:
<https://docs.djangoproject.com/en/1.9/ref/models/instances/#validating-objects>

On 30.05.2016 12:38, Vinayak Kaniyarakkal wrote:
The following code is "failing silently"

    class MyModel(models.Model):
        CHOICES = ((0, 'Inactive'), (1, 'Active'),)
        my_field = models.PositiveIntegerField(choices=ACTIVE_CHOICES,
    default=2)

    obj = MyModel.objects.all()[0]
    obj.my_field=100
    obj.save()


Should I raise a bug in Django?
--
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 django-users+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
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/a073eaca-0e92-4685-ae93-113fc8f0840e%40googlegroups.com <https://groups.google.com/d/msgid/django-users/a073eaca-0e92-4685-ae93-113fc8f0840e%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/574C0DBD.8070204%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to