[CentralOH] Introspection of unique_together

Kurtis Mullins kurtis.mullins at gmail.com
Wed Dec 5 02:02:53 CET 2012


My apologies, I meant Model as a placeholder for your Model class name; not
the Model class itself. For example:

Person.meta.unique_together
On Dec 4, 2012 8:01 PM, <jep200404 at columbus.rr.com> wrote:

> On Tue, 4 Dec 2012 18:55:26 -0500, Kurtis Mullins <
> kurtis.mullins at gmail.com> wrote:
>
> > Possibly Model.meta.unique_together, but I haven't tried it.
>
>         print repr(Model.meta.unique_together)
>     NameError: global name 'Model' is not defined
>
>         print repr(models.Model.meta.unique_together)
>     AttributeError: type object 'Model' has no attribute 'meta'
>
>         print repr(models.Model.Meta.unique_together)
>     AttributeError: type object 'Model' has no attribute 'Meta'
>
> How would Model or models.Model know about any one particular
> class anyway? I had already tried cls.Meta.unique_together
> (in a class method) without success before my original post.
> Here's some more.
>
>         print repr(cls.Meta.unique_together)
>     AttributeError: type object 'Book' has no attribute 'Meta'
>
>         print repr(cls.meta.unique_together)
>     AttributeError: type object 'Book' has no attribute 'meta'
>
>         print repr(cls.unique_together)
>     AttributeError: type object 'Book' has no attribute 'unique_together'
>
> _______________________________________________
> CentralOH mailing list
> CentralOH at python.org
> http://mail.python.org/mailman/listinfo/centraloh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20121204/12e173b3/attachment.html>


More information about the CentralOH mailing list