validators not working in shell

25 views
Skip to first unread message

alghafli

unread,
Jul 12, 2014, 6:46:17 AM7/12/14
to django...@googlegroups.com
Hello
I am creating a django library application. I have made a book model and
it has some fields with validators. Most of them are standard
MinValueValidator and MaxValueValidator.
Using the webserver, the validators work completely fine. I see errors
when I put invalid values. However, when I tested saving objects using
the shell, the validators are not called. I am using the shell because I
am planning to import the database from existing csv files.

Is there something wrong? Or am I responsible to call the validators
manually before save()?

tim

unread,
Jul 12, 2014, 1:12:09 PM7/12/14
to django...@googlegroups.com
Model validation is not invoked when calling model.save(). You can read more here: https://docs.djangoproject.com/en/1.6/ref/models/instances/#validating-objects

alghafli

unread,
Jul 13, 2014, 10:24:31 AM7/13/14
to django...@googlegroups.com
Thank you. That helped me solving the problem :)
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2464d4fe-cadc-45e5-a2bc-e0276d148f31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages