app.view.dependency module¶
- class app.view.dependency.HttpRequest[源代码]¶
基类:
object
A basic HTTP request.
- accepted_types¶
Return a list of MediaType instances.
- property body¶
- build_absolute_uri(location=None)[源代码]¶
Build an absolute URI from the location and the variables available in this request. If no
location
is specified, build the absolute URI using request.get_full_path(). If the location is absolute, convert it to an RFC 3987 compliant URI and return it. If location is relative or is scheme-relative (i.e.,//example.com/
), urljoin() it to a base URL constructed from the request variables.
- property encoding¶
- get_signed_cookie(key, default=<object object>, salt='', max_age=None)[源代码]¶
Attempt to return a signed cookie. If the signature fails or the cookie has expired, raise an exception, unless the default argument is provided, in which case return that value.
- headers¶
- property scheme¶
- property upload_handlers¶
- class app.view.dependency.HttpResponse(content=b'', *args, **kwargs)[源代码]¶
基类:
HttpResponseBase
An HTTP response class with a string as content.
This content can be read, appended to, or replaced.
- property content¶
- streaming = False¶
- class app.view.dependency.JsonResponse(data, encoder=<class 'django.core.serializers.json.DjangoJSONEncoder'>, safe=True, json_dumps_params=None, **kwargs)[源代码]¶
基类:
HttpResponse
An HTTP response class that consumes data to be serialized to JSON.
- 参数:
data -- Data to be dumped into json. By default only
dict
objects are allowed to be passed due to a security flaw before ECMAScript 5. See thesafe
parameter for more information.encoder -- Should be a json encoder class. Defaults to
django.core.serializers.json.DjangoJSONEncoder
.safe -- Controls if only
dict
objects may be serialized. Defaults toTrue
.json_dumps_params -- A dictionary of kwargs passed to json.dumps().
- class app.view.dependency.ProfileJsonView(**kwargs)[源代码]¶
基类:
ProfileView
,SecureJsonView
- args: _ArgType¶
- data: dict[str, Any]¶
- kwargs: _KWType¶
- logger_name: str = 'ProfileAPIerror'¶
- request: UserRequest¶
- class app.view.dependency.ProfileTemplateView(**kwargs)[源代码]¶
基类:
ProfileView
,SecureTemplateView
- args: _ArgType¶
- extra_context: dict[str, Any]¶
- kwargs: _KWType¶
- logger_name: str = 'ProfileError'¶
- page_name: str¶
- request: UserRequest¶
- template_name: str¶
- class app.view.dependency.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.
- app.view.dependency.UserRequest¶
HttpRequest
的别名
- app.view.dependency.login_required(function=None, redirect_field_name='next', login_url=None)[源代码]¶
Decorator for views that checks that the user is logged in, redirecting to the log-in page if necessary.
- app.view.dependency.message_url(context: dict | dict, url: str = '/welcome/') str [源代码]¶
提供要发送的信息体和原始URL,返回带提示信息的URL - context: 包含`warn_code`和`warn_message`的字典 - url: str, 可以包含GET参数
- app.view.dependency.redirect(to, *args, permanent=False, **kwargs)[源代码]¶
Return an HttpResponseRedirect to the appropriate URL for the arguments passed.
The arguments could be:
A model: the model's get_absolute_url() function will be called.
A view name, possibly with arguments: urls.reverse() will be used to reverse-resolve the name.
A URL, which will be used as-is for the redirect location.
Issues a temporary redirect by default; pass permanent=True to issue a permanent redirect.
- app.view.dependency.render(request, template_name, context=None, content_type=None, status=None, using=None)[源代码]¶
Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments.