On Mar 19, 11:01 am, cpx <[email protected]> wrote: > Is it possible to retrieve a list of attributes valid for a given > model object, without actually having an instance of that object? I > want to be able to check if a given attribute is present on a model. > > Currently, I'm doing this: > dummy = MyModelObject() > if attributeName in dir(dummy): > # do something > > But I would like to do it without referencing any model instance.
Look at the various methods under MyModel._meta. get_all_field_names() will probably fit the bill. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

