How can you test several-to-many-fields in the DNS?
I wanted to do this like this:
import digenous field .__ class__ == django.db.models.fields.related.ManyRelatedManager
This is not work, because the class has many relayed managers
not found. But if I do field .__ class __
then the output is django.db.models.fields.related.ManyRelatedManager
this refers to a class Why does not it seem and how can I bring it to work?
Many thanks for your help.
If you already have field examples, then you can do just that:
< If you have only the related manager example, you can reverse the field to see the example: ifense (field, multipleTomainField): pass / luggage P> > & gt; & Gt; & Gt; Print FM & lt; Category 'django.db.models.fields.related.ManyRelatedManager' & gt; & Gt; & Gt; & Gt; Print fm.instance._meta.get_field_by_name ('fieldnamehere') (& lt; django.db.models.fields.related.ForeignKey: fieldnamehere & gt; any, true, false)
< P> it is only tested on Django 1.5
Comments
Post a Comment