Opened 14 years ago

Last modified 14 years ago

#14124 closed

Cannot use a proxy model with unique_together — at Initial Version

Reported by: mlhamel Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've just used a proxy model in my own custom application and i've just found a small problem. Right now, to be able to create a Proxy model, i'm force to redefine a Meta options like that:

class NewDiscount(Discount):

class Meta:

proxy = True

The problem i have is that the original discount object defined the following Meta options:

class Discount(models.Model):

class Meta:

verbose_name = _("Discount")
verbose_name_plural = _("Discounts")
unique_together = ('slug', 'amount')

Since i've overwritten the Meta class I should copy the original Meta options inside my Proxy model like that:

class NewDiscount(Discount):

class Meta:

proxy = True
verbose_name = _("Discount")
verbose_name_plural = _("Discounts")
unique_together = ('slug', 'amount')

But, when I'm doing that, Django throw me an error saying:

"store.discount: "unique_together" refers to site. This is not in the same model as the unique_together statement."

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top