generic.models module¶
models.py
- 自定义用户模型
任何应用模型如果有用户模型关系,都应该导入,并提供导出
任何应用都应从其models文件导入User模型
- 用户管理器
提供管理方法,并保存记录
注意事项 - 如果在使用本应用前已经迁移过,且想保留用户数据,请务必参考readme.md
@Author pht @Date 2022-08-19
- class generic.models.CreditRecord(*args, **kwargs)[源代码]¶
基类:
Model
信用分更改记录
只起记录作用,应通过User管理器方法自动创建
- exception DoesNotExist¶
基类:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
基类:
MultipleObjectsReturned
- delta¶
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_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=True, **kwargs)¶
- get_previous_by_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- new_credit¶
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>¶
- old_credit¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- overflow¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- time¶
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 many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- class generic.models.PermissionBlacklist(*args, **kwargs)[源代码]¶
基类:
Model
权限黑名单
记录哪些用户被取消了哪些权限。在认证后端鉴权时,这个表中记录的信息比用户组优先级更高。
- exception DoesNotExist¶
基类:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
基类:
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: PermissionBlacklistManager = <generic.models.PermissionBlacklistManager object>¶
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- class generic.models.User(*args, **kwargs)[源代码]¶
基类:
AbstractUser
,PointMixin
用户模型
Attributes: - id: 用户主键 - username: 用户名,学号 - name: 用户名称 - utype: 用户类型,参考User.Type - 其它继承字段参考AbstractUser
See Also: -
UserManager
-django.contrib.auth.models.AbstractUser
- exception DoesNotExist¶
基类:
ObjectDoesNotExist
- MAX_CREDIT: Final = 3¶
- MIN_CREDIT: Final = 0¶
- exception MultipleObjectsReturned¶
基类:
MultipleObjectsReturned
- REQUIRED_FIELDS = ['name']¶
- class Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[源代码]¶
基类:
TextChoices
- ORG = 'Organization'¶
- PERSON = 'Person'¶
- SPECIAL = ''¶
- STUDENT = 'Student'¶
- TEACHER = 'Teacher'¶
- UNAUTHORIZED = 'Unauthorized'¶
- YQpoint¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- academicqaawards¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- accept_anonymous_chat¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- accept_chat¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- achievementunlock_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- acronym¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- agreement_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- answersheet_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- comment_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- credit¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- creditrecord_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- date_joined¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- dormitoryassignment_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- email¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- first_name¶
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)¶
- get_utype_display(*, field=<django.db.models.fields.CharField: utype>)¶
- 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.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.
- is_active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_newuser¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_staff¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_superuser¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_login¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- logentry_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- modify_records¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- modifyorganization_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- modulelog_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- naturalperson¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- objects: UserManager = <generic.models.UserManager object>¶
- organization¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- pagelog_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- password¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permissionblacklist_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- pinyin¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- poolrecord_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- prize_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- receive_chat_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- recv_notice¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- send_chat_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- send_notice¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- survey_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- username¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- utype: Type | str¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- yqpointrecord_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class generic.models.YQPointRecord(*args, **kwargs)[源代码]¶
基类:
Model
元气值更改记录
只起记录作用,应通过User管理器方法自动创建
- exception DoesNotExist¶
基类:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
基类:
MultipleObjectsReturned
- class SourceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[源代码]¶
基类:
IntegerChoices
- ACHIEVE = 4¶
- ACTIVITY = 2¶
- CHECK_IN = 1¶
- COMPENSATION = 7¶
- CONSUMPTION = 6¶
- FEEDBACK = 3¶
- QUESTIONNAIRE = 5¶
- SYSTEM = 0¶
- delta¶
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_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=True, **kwargs)¶
- get_previous_by_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=False, **kwargs)¶
- get_source_type_display(*, field=<django.db.models.fields.SmallIntegerField: source_type>)¶
- 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>¶
- source¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- time¶
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 many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶