Open malexeev opened 10 years ago
Since currently unique_together
is not affected it refers to original field which value is unknown.
However, validation should fail. Need to check.
Or: rewrite unique_together
if contains translation fields? But how: with default language only, or with all possible combinations?
Same problem here.
I'm working on a project and I need to translate option
attribute in this model. Is there a way to manage this scenario?
class AttributeOption(models.Model):
group = models.ForeignKey(...)
option = models.CharField(...)
class Meta:
unique_together = ('group', 'option')
class AttributeOptionTranslation(TranslationOptions):
fields = ('option',)
Probably it is a bug, pull-request or ideas how this should be fixed are welcomed.
I have a model with 2 fields that are marked as unique_together. One of the fields is being translated by django-modeltranslation.
Using standard Django admin on this model works fine, it shows validation error when trying to insert duplicates. But the TranslationAdmin seems to ignore that validation. It all goes directly to the database, hitting the same database constraint (well, a unique index) crashing.
Is it a bug, or am I doing something wrong?