django 高级 ORM 对象参数剖析

from django.db import models

class UserInfo(models.Model):
username=models.CharField(max_length=32,verbose_name='用户名')
password=models.CharField(max_length=32,verbose_name='密码')

ui=UserInfo()
for k,v in ui._meta.__dict__.items():
  print(k,'-------->',v)
-------------------->得到结果<-------------------------

private_fields --------> []
verbose_name --------> user info
original_attrs --------> {}
model_name --------> userinfo
db_tablespace -------->
unique_together --------> []
_ordering_clash --------> False
required_db_features --------> []
concrete_model --------> <class 'app01.models.UserInfo'>
local_fields --------> [<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>]
managed --------> True
get_latest_by --------> None
proxy --------> False
abstract --------> False
select_on_save --------> False
required_db_vendor --------> None
apps --------> <django.apps.registry.Apps object at 0x00000192F4D85C50>
auto_created --------> False
fields --------> (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>)
auto_field --------> app01.UserInfo.id
concrete_fields --------> (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>)
parents --------> OrderedDict()
default_manager_name --------> None
app_label --------> app01
_get_fields_cache --------> {(True, False, True, False, True): (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>)}
default_related_name --------> None
permissions --------> []
default_permissions --------> ('add', 'change', 'delete')
local_many_to_many --------> []
manager_inheritance_from_future --------> False
index_together --------> []
db_table --------> app01_userinfo
object_name --------> UserInfo
proxy_for_model --------> None
related_fkey_lookups --------> []
verbose_name_plural --------> user infos
model --------> <class 'app01.models.UserInfo'>
order_with_respect_to --------> None
swappable --------> None
local_managers --------> [<django.db.models.manager.Manager object at 0x00000192F74E4780>]
ordering --------> []
base_manager_name --------> None
pk --------> app01.UserInfo.id
indexes --------> []
auto_created --------> False
index_together --------> []
original_attrs --------> {}
select_on_save --------> False
required_db_features --------> []
manager_inheritance_from_future --------> False
local_fields --------> [<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>]
order_with_respect_to --------> None
abstract --------> False
swappable --------> None
required_db_vendor --------> None
default_manager_name --------> None
managed --------> True
local_managers --------> [<django.db.models.manager.Manager object at 0x0000021B47194748>]
related_fkey_lookups --------> []
default_permissions --------> ('add', 'change', 'delete')
local_many_to_many --------> []
ordering --------> []
auto_field --------> app01.UserInfo.id
unique_together --------> []
default_related_name --------> None
app_label --------> app01
permissions --------> []
verbose_name --------> user info
concrete_model --------> <class 'app01.models.UserInfo'>
concrete_fields --------> (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>)
fields --------> (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>)
db_table --------> app01_userinfo
indexes --------> []
base_manager_name --------> None
model_name --------> userinfo
pk --------> app01.UserInfo.id
db_tablespace -------->
proxy_for_model --------> None
proxy --------> False
object_name --------> UserInfo
_ordering_clash --------> False
model --------> <class 'app01.models.UserInfo'>
verbose_name_plural --------> user infos
get_latest_by --------> None
_get_fields_cache --------> {(True, False, True, False, True): (<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: username>, <django.db.models.fields.CharField: password>)}
private_fields --------> []
apps --------> <django.apps.registry.Apps object at 0x0000021B44A33C88>
parents --------> OrderedDict()






posted @ 2017-11-20 10:29  昂达达  阅读(563)  评论(0编辑  收藏  举报