Changes between Initial Version and Version 1 of Ticket #14124


Ignore:
Timestamp:
Aug 17, 2010, 9:29:08 PM (14 years ago)
Author:
Karen Tracey
Comment:

Fixed formatting. Please use WikiFormatting and use Preview before submitting.

Why do you think you have to copy the Meta class wholesale? Given that unique_together affects the database table definitions, and proxy models are intended to simply change Python behavior while using the database table from the proxied model, it does not make sense to copy unique_together into the proxy model. So, what problem do you encounter if you do not attempt to set unique_together in the proxy model? That would be a problem to investigate and fix, if there is one. For now closing this as invalid since the described behavior appears correct to me.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14124

    • Property Resolutioninvalid
    • Property Status newclosed
  • Ticket #14124 – Description

    initial v1  
    11I'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:
    2 
     2{{{
     3#!python
    34class NewDiscount(Discount):
    45    class Meta:
    56        proxy = True
     7}}}
    68
    79The problem i have is that the original discount object defined the following Meta options:
    810
     11{{{
     12#!python
    913class Discount(models.Model):
    1014    class Meta:
     
    1216        verbose_name_plural = _("Discounts")
    1317        unique_together = ('slug', 'amount')
     18}}}
     19
    1420
    1521Since i've overwritten the Meta class I should copy the original Meta options inside my Proxy model like that:
    1622
     23{{{
     24#!python
    1725class NewDiscount(Discount):
    1826    class Meta:
     
    2129        verbose_name_plural = _("Discounts")
    2230        unique_together = ('slug', 'amount')
     31}}}
    2332
    2433But, when I'm doing that, Django throw me an error saying:
Back to Top