About models validators location

14 views
Skip to first unread message

durir...@gmail.com

unread,
Jul 29, 2015, 10:54:03 AM7/29/15
to Django users
I've searched for where to put the validators for my models, but I only found that they fit in models.py, outside the model class.
Is that correct or I should create a specific file for them?

felix

unread,
Jul 29, 2015, 11:40:45 AM7/29/15
to django...@googlegroups.com
El 29/07/15 10:54, durir...@gmail.com escribió:
I've searched for where to put the validators for my models, but I only found that they fit in models.py, outside the model class.
Is that correct or I should create a specific file for them?

I think that you can put validators in another file if you have several of them or want to reuse them somewhere else. Just import them in models.py.

durir...@gmail.com

unread,
Jul 29, 2015, 2:45:29 PM7/29/15
to Django users, fe...@epepm.cupet.cu
Yeah, I can put it whenever I want, and just import then, but it is good to know the exact way (as when following PEP 8).
Reply all
Reply to author
Forward
0 new messages