app_models package¶
Submodules¶
app_models.admin module¶
app_models.apps module¶
app_models.models module¶
[项目的models] 所有models的定义都在同目录下其它的文件中定义 所有定义models的文件,命名都类似这样:models_for_some_app.py 所有app用到的models都从这里import from .models_for_some_app import MyModel
app_models.models_customuser module¶
-
class
app_models.models_customuser.CustomUser(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined, chinese_name, chinese_pass, chinese_addr, chinese_info)[源代码]¶ 基类:
django.contrib.auth.models.AbstractUser-
exception
DoesNotExist¶ 基类:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ 基类:
django.core.exceptions.MultipleObjectsReturned
-
chinese_addr¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
chinese_info¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
chinese_name¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
chinese_pass¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)¶
-
get_previous_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=False, **kwargs)¶
-
groups¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user_permissions¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
exception
app_models.models_extra_user module¶
[使用one to one扩展User模型]
-
class
app_models.models_extra_user.UserExtra(*args, **kwargs)[源代码]¶ 基类:
django.db.models.base.Model- [扩展django的用户模型]
user 是一个OneToOneField
- 参数
{[type]} -- [description] (models) –
-
exception
DoesNotExist¶ 基类:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ 基类:
django.core.exceptions.MultipleObjectsReturned
-
id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects= <django.db.models.manager.Manager object>¶
-
pay_password¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
phone¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
qq¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.placeis aForwardOneToOneDescriptorinstance.
-
user_id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
weixin_openid¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
app_models.tests module¶
app_models.urls module¶
app_models.views module¶
Module contents¶
这是一个专为模型创建的app 所有的模型都放在这个app里 所有的模型都以models_开头,后面再加上具体内容或用途,例如: models_customuser.py, 为自定义用户而创建的模型 models_extra_user.py, 为用户模型增加一些extra的信息
然后在models.py文件里,import 需要的模型类