[CentralOH] Introspection of unique_together

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Wed Dec 5 02:01:20 CET 2012


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'



More information about the CentralOH mailing list