django-modeltranslation
django-modeltranslation copied to clipboard
Admin returns error: This field is required field
I have in my model an object Initiative that has a title which is translated in English and Italian. I want the object to have a title value for Italian or for English (both is also accepted) but no title is not accepted.
I use this model and admin
models.py: class Initiative(models.Model): title = models.CharField(max_length=1000, null=False, blank=False)
admin.py class InitiativeAdmin(TranslationAdmin, BeautyTranslationAdmin): model = Initiative fields = ('title',)
The admin form shows that the English title is mandatory (the label is bold) but the italian title isn't even if it should be bold on both looking at the model definition, I guess. If I submit an an object with italian title but no English title I get "This field is required" error, if I submit an object with english title and no Italian title, no problem.
I tried overriding the object save() method and clean() method and inserting my validation logic but modeltranslation raises a ValidationError before Django can get to those methods.
What's the best way of overriding this behaviour and insert my validation logic?