django中ModelBase的属性

django中model类都是ModelBase的子类。ModelBase是在django.db.models.base中定义的。
如果一个mdoel类是ModelBase的子类,他的属性有:
['DoesNotExist', 'MultipleObjectsReturned', '__class__', '__delattr__', '__dict__',
'__doc__', '__eq__', '__getattribute__', '__hash__', '__init__', '__metaclass__',
'__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', '__unicode__', '__weakref__', '_base_manager',
'_collect_sub_objects', '_default_manager', '_deferred', '_get_FIELD_display',
'_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', '_get_pk_val',
'_meta', '_set_pk_val', 'delete', 'objects', 'permissions', 'pk',
'prepare_database_save', 'save', 'save_base', 'serializable_value', 'user_set']

其中_meta的属性有:
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', '__weakref__', '_field_cache', '_field_name_cache',
'_fields', '_fill_fields_cache', '_fill_m2m_cache', '_fill_related_many_to_many_cache',
'_fill_related_objects_cache', '_join_cache', '_m2m_cache', '_many_to_many',
'_prepare', '_related_many_to_many_cache', '_related_objects_cache', 'abstract',
'abstract_managers', 'add_field', 'add_virtual_field', 'admin', 'app_label',
'auto_field', 'concrete_managers', 'contribute_to_class', 'db_table', 'db_tablespace',
'duplicate_targets', 'fields', 'get_add_permission', 'get_all_field_names',
'get_all_related_m2m_objects_with_model', 'get_all_related_many_to_many_objects',
'get_all_related_objects', 'get_all_related_objects_with_model', 'get_ancestor_link',
'get_base_chain', 'get_change_permission', 'get_delete_permission', 'get_field',
'get_field_by_name', 'get_fields_with_model', 'get_latest_by', 'get_m2m_with_model',
'get_ordered_objects', 'get_parent_list', 'has_auto_field', 'init_name_map',
'installed', 'local_fields', 'local_many_to_many', 'managed', 'many_to_many',
'module_name', 'object_name', 'order_with_respect_to', 'ordering', 'parents',
'permissions', 'pk', 'pk_index', 'proxy', 'proxy_for_model', 'setup_pk',
'setup_proxy', 'unique_together', 'verbose_name', 'verbose_name_plural',
 'verbose_name_raw', 'virtual_fields']

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Related posts:

  1. python元类的一些新认识

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Contact us

Admin: Bryan Wu