Hi, You'ew hitting limitation of Django ORM which prohibits overriding fields.
https://docs.djangoproject.com/en/1.3/topics/db/models/#field-name-hiding-is-not-permitted 4.4.2012 6:34, shiva kirjoitti:
Hello! In our apps (that use Django 1.2.7) we use following models: class BaseRegistration(models.Model): exhibition = models.ForeignKey(...) year = models.IntegerField(...) user = models.ForeignKey('auth.User') class BarcodeRegistration(BaseRegistration): class Meta: abstract = True class EventRegistration(BarcodeRegistration): event = models.ForeignKey(...) I append *validate_unique* by *user* and *event* fields in EventRegistration class: class EventRegistration(BarcodeRegistration): event = models.ForeignKey(...) user = models.ForeignKey('auth.User') class Meta: unique_together = ('event', 'user') But in django command manage.py validate fails with error: exhibition.eventregistration: "unique_together" refers to user. This is not in the same model as the unique_together statement. After some "pdb'ing" of django.core.management.validation, django.db.models.base, and django.db.models.options I found, that is happend because: In [13]: EventRegistration._meta.get_field('user') in EventRegistration._meta.parents.keys()[0]._meta.local_fields Out[13]: True In [14]: EventRegistration._meta.get_field('user') in EventRegistration._meta.local_fields Out[14]: False Is it's something wrong with our code? Thanks -- Shavrin Ivan
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.