'At least one of these fields must be filled' - Can I enforce this requirement in Django models? -



'At least one of these fields must be filled' - Can I enforce this requirement in Django models? -

here's utilize case:

class tweet(models.model): url_1 = models.charfield(max_length=140) url_2 = models.charfield(max_length=140) url_3 = models.charfield(max_length=140)

i'd user specify @ to the lowest degree 1 url each tweet instance.

i know how enforce status in views.py, i'm wondering if there's way configure django model such user required fill in @ to the lowest degree 1 out of given set of model fields before instance can saved. think solution cleaner.

thanks!

it can't done @ model level, may possible add together constraint @ database level can enforce this.

django django-models

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -