모델 참조¶
이 문서는 wagtail.models 모듈 내의 모델 클래스에 대한 참조 정보를 포함합니다.
Page¶
데이터베이스 필드¶
- class wagtail.models.Page¶
- title¶
(텍스트)
페이지의 사람이 읽을 수 있는 제목입니다.
- draft_title¶
(텍스트)
페이지의 사람이 읽을 수 있는 제목으로, 초안 편집에서 변경된 내용을 포함합니다(게시된 페이지의 경우
title필드는 현재 게시된 버전의 제목임).
- slug¶
(텍스트)
페이지의 URL을 구성하는 데 사용됩니다.
예:
http://domain.com/blog/[my-slug]/
- content_type¶
(
django.contrib.contenttypes.models.ContentType에 대한 외래 키)이 페이지의 특정 모델을 나타내는
ContentType객체에 대한 외래 키입니다.
- live¶
(부울)
페이지가 게시된 경우
True로 설정되는 부울입니다.참고: 이 필드는 기본적으로
True로 설정되어 프로그래밍 방식으로 생성된 모든 페이지가 기본적으로 게시됩니다.
- has_unpublished_changes¶
(부울)
페이지가 초안이거나 초안 변경 사항과 함께 게시된 경우
True로 설정되는 부울입니다.
- owner¶
(사용자 모델에 대한 외래 키)
페이지를 만든 사용자에 대한 외래 키입니다.
- first_published_at¶
(날짜/시간)
페이지가 처음 게시된 날짜/시간입니다.
- last_published_at¶
(날짜/시간)
페이지가 마지막으로 게시된 날짜/시간입니다.
- seo_title¶
(텍스트)
페이지의
<title>HTML 태그에 사용하기 위한 대체 SEO 최적화 제목입니다.
- search_description¶
(텍스트)
검색 색인에 사용되는 콘텐츠의 SEO 최적화 설명입니다. 페이지의
<meta name="description">HTML 태그에도 적합합니다.
(부울)
페이지가 사이트 전체 메뉴에 포함되어야 하는지 여부를 전환하며, 페이지 편집기의
promote_panels에 표시됩니다.Wagtail은 기본적으로 메뉴 구현을 포함하지 않으므로, 이 필드는 특정 Wagtail 설치에서 그렇게 구축되지 않는 한 프런트엔드 콘텐츠에서 아무것도 하지 않습니다.
그러나 이는
in_menu()QuerySet 필터에서 이 필드를 사용하는 페이지를 더 쉽게 쿼리하는 데 사용됩니다.기본값은
False이며, 모델에서show_in_menus_default = True로 재정의할 수 있습니다.참고
모든 페이지에 대한 전역 기본값을 설정하려면
Page모델을 처음 가져올 때Page.show_in_menus_default = True를 한 번 설정하십시오.
- locked¶
(부울)
True로 설정되면 Wagtail 편집기는 어떤 사용자도 페이지의 콘텐츠를 편집할 수 없습니다.locked_by도 설정된 경우 해당 사용자만 페이지를 편집할 수 있습니다.
- locked_by¶
(사용자 모델에 대한 외래 키)
현재 페이지를 잠근 사용자입니다. 이 사용자만 페이지를 편집할 수 있습니다.
locked가True일 때 이것이None이면 아무도 페이지를 편집할 수 없습니다.
- locked_at¶
(날짜/시간)
페이지가 잠긴 날짜/시간입니다.
- alias_of¶
(다른 페이지에 대한 외래 키)
설정된 경우 이 페이지는 이 필드에서 참조되는 페이지의 별칭입니다.
- locale¶
(Locale에 대한 외래 키)
이 외래 키는 페이지 언어를 나타내는
Locale객체에 연결됩니다.
- translation_key¶
(uuid)
새 페이지가 생성될 때마다 무작위로 생성되는 UUID입니다. 이는 해당 인스턴스의 모든 번역과 공유되므로 번역을 쿼리하는 데 사용할 수 있습니다.
translation_key값은 각 로케일의 한 페이지에서만 사용할 수 있습니다.
메서드 및 속성¶
제공된 모델 필드 외에도 Page 에는 자체 모델을 만들 때 참조, 사용 또는 재정의할 수 있는 많은 속성 및 메서드가 있습니다.
참고
django-treebeard의 노드 API도 참조하십시오. Page 는 materialized path tree 노드의 서브클래스입니다.
- class wagtail.models.Page
- get_specific(deferred=False, copy_attrs=None, copy_attrs_exclude=None)¶
Return this object in its most specific subclassed form.
By default, a database query is made to fetch all field values for the specific object. If you only require access to custom methods or other non-field attributes on the specific object, you can use
deferred=Trueto avoid this query. However, any attempts to access specific field values from the returned object will trigger additional database queries.By default, references to all non-field attribute values are copied from current object to the returned one. This includes:
Values set by a queryset, for example: annotations, or values set as a result of using
select_related()orprefetch_related().Any
cached_propertyvalues that have been evaluated.Attributes set elsewhere in Python code.
For fine-grained control over which non-field values are copied to the returned object, you can use
copy_attrsto specify a complete list of attribute names to include. Alternatively, you can usecopy_attrs_excludeto specify a list of attribute names to exclude.If called on an object that is already an instance of the most specific class, the object will be returned as is, and no database queries or other operations will be triggered.
If the object was originally created using a model that has since been removed from the codebase, an instance of the base class will be returned (without any custom field values or other functionality present on the original class). Usually, deleting these objects is the best course of action, but there is currently no safe way for Wagtail to do that at migration time.
- specific¶
Returns this object in its most specific subclassed form with all field values fetched from the database. The result is cached in memory.
- specific_deferred¶
Returns this object in its most specific subclassed form without any additional field values being fetched from the database. The result is cached in memory.
- specific_class¶
Return the class that this object would be if instantiated in its most specific form.
If the model class can no longer be found in the codebase, and the relevant
ContentTypehas been removed by a database migration, the return value will beNone.If the model class can no longer be found in the codebase, but the relevant
ContentTypeis still present in the database (usually a result of switching between git branches without running or reverting database migrations beforehand), the return value will beNone.
- cached_content_type¶
Return this object’s
content_typevalue from theContentTypemodel’s cached manager, which will avoid a database query if the content type is already in memory.
- page_type_display_name¶
A human-readable version of this page’s type.
- get_url(request=None, current_site=None)¶
Return the ‘most appropriate’ URL for referring to this page from the pages we serve, within the Wagtail backend and actual website templates; this is the local URL (starting with ‘/’) if we’re only running a single site (i.e. we know that whatever the current page is being served from, this link will be on the same domain), and the full URL (with domain) if not. Return
Noneif the page is not routable.Accepts an optional but recommended
requestkeyword argument that, if provided, will be used to cache site-level URL information (thereby avoiding repeated database / cache lookups) and, via theSite.find_for_request()function, determine whether a relative or full URL is most appropriate.
- get_full_url(request=None)¶
Return the full URL (including protocol / domain) to this page, or
Noneif it is not routable.
- full_url¶
Return the full URL (including protocol / domain) to this page, or
Noneif it is not routable.
- relative_url(current_site, request=None)¶
Return the ‘most appropriate’ URL for this page taking into account the site we’re currently on; a local URL if the site matches, or a fully qualified one otherwise. Return
Noneif the page is not routable.Accepts an optional but recommended
requestkeyword argument that, if provided, will be used to cache site-level URL information (thereby avoiding repeated database / cache lookups).
- get_site()¶
Return the Site object that this page belongs to.
- get_url_parts(request=None)¶
Determine the URL for this page and return it as a tuple of
(site_id, site_root_url, page_url_relative_to_site_root). ReturnNoneif the page is not routable, or return(site_id, None, None)ifNoReverseMatchexception is raised.This is used internally by the
full_url,url,relative_urlandget_siteproperties and methods; pages with custom URL routing should override this method in order to have those operations return the custom URLs.Accepts an optional keyword argument
request, which may be used to avoid repeated database / cache lookups. Typically, a page model that overridesget_url_partsshould not need to deal withrequestdirectly, and should just pass it to the original method when callingsuper.
- route(request, path_components)¶
- serve(request, *args, **kwargs)¶
- static route_for_request(request: HttpRequest, path: str) RouteResult | None¶
Find the page route for the given HTTP request object, and URL path. The route result (page, args, and kwargs) will be cached via
request._wagtail_route_for_request.
- static find_for_request(request: HttpRequest, path: str) Page | None¶
Find the page for the given HTTP request object, and URL path. The full page route will be cached via
request._wagtail_route_for_request.
- get_default_privacy_setting(request)¶
페이지의 기본 개인 정보 설정을 지정합니다.
이 메서드는 최소한 ‘type’ 키가 있는 사전을 반환해야 합니다. 값은
PageViewRestriction의restriction_type에서 다음 값 중 하나여야 합니다.BaseViewRestriction.NONE: 페이지가 공개되어 누구나 액세스할 수 있습니다. (기본값) - ‘{“type”: BaseViewRestriction.NONE}’BaseViewRestriction.LOGIN: 페이지가 비공개이며 인증된 사용자만 액세스할 수 있습니다. - ‘{“type”: BaseViewRestriction.LOGIN}’BaseViewRestriction.PASSWORD: 페이지가 비공개이며 공유 암호가 있는 사용자만 액세스할 수 있습니다. (사전에 추가password키 필요) - ‘{“type”: BaseViewRestriction.PASSWORD, “password”: “P@ssw0rd123!”}’BaseViewRestriction.GROUPS: 페이지가 비공개이며 특정 그룹의 사용자만 액세스할 수 있습니다. (그룹 객체 목록이 있는 추가groups키 필요) - ‘{“type”: BaseViewRestriction.GROUPS, “groups”: [moderators, editors]}’
예시
class BreadsIndexPage(Page): #... def get_default_privacy_setting(request): from wagtail.models import BaseViewRestriction # 편집자가 foo.add_bar 권한을 가지고 있다면 기본값을 중재자 및 편집자 그룹이 체크된 그룹으로 설정합니다. if request.user.has_perm("foo.add_bar"): moderators = Group.objects.filter(name="Moderators").first() editors = Group.objects.filter(name="Editors").first() return {"type": BaseViewRestriction.GROUPS, "groups": [moderators,editors]} else: return {"type": BaseViewRestriction.NONE}
- context_object_name = None¶
페이지의
Context에서 페이지 인스턴스에 대한 사용자 지정 이름입니다.
- get_context(request, *args, **kwargs)¶
- get_template(request, *args, **kwargs)¶
- get_admin_display_title()¶
Return the title for this page as it should appear in the admin backend; override this if you wish to display extra contextual information about the page, such as language. By default, returns
draft_title.
- allowed_http_methods = [<HTTPMethod.DELETE>, <HTTPMethod.GET>, <HTTPMethod.HEAD>, <HTTPMethod.OPTIONS>, <HTTPMethod.PATCH>, <HTTPMethod.POST>, <HTTPMethod.PUT>]¶
이 속성을 사용자 지정할 때 개발자는 Python의 내장
http.HTTPMethod열거형의 값을 목록에 사용하는 것이 좋습니다. 더 강력하고 이미 메모리에 존재하는 값을 사용하기 때문입니다. 예를 들어:from http import HTTPMethod class MyPage(Page): allowed_http_methods = [HTTPMethod.GET, HTTPMethod.OPTIONS]
http.HTTPMethod열거형은 Python 3.11까지 추가되지 않았으므로 프로젝트에서 이전 버전의 Python을 사용하는 경우 대신 대문자 문자열을 사용할 수 있습니다. 예를 들어:class MyPage(Page): allowed_http_methods = ["GET", "OPTIONS"]
- check_request_method(request, *args, **kwargs)¶
Checks the
methodattribute of the request against those supported by the page (as defined byallowed_http_methods) and responds accordingly.If supported,
Noneis returned, and the request is processed normally. If not, a warning is logged and anHttpResponseNotAllowedis returned, and any further request handling is terminated.
- handle_options_request(request, *args, **kwargs)¶
Returns an
HttpResponsewith an"Allow"header containing the list of supported HTTP methods for this page. This method is used instead ofserve()to handle requests when theOPTIONSHTTP verb is detected (andHTTPMethod.OPTIONSis present inallowed_http_methodsfor this type of page).
- preview_modes¶
A list of
(internal_name, display_name)tuples for the modes in which this object can be displayed for preview/moderation purposes. Ordinarily an object will only have one display mode, but subclasses can override this - for example, a page containing a form might have a default view of the form, and a post-submission ‘thank you’ page. Set to[]to completely disable previewing for this model.
- default_preview_mode¶
The default preview mode to use in live preview. This default is also used in areas that do not give the user the option of selecting a mode explicitly, e.g. in the moderator approval workflow. If
preview_modesis empty, anIndexErrorwill be raised.
- preview_sizes¶
A list of dictionaries, each representing a preview size option for this object. Override this property to customize the preview sizes. Each dictionary in the list should include the following keys:
name: A string representing the internal name of the preview size.icon: A string specifying the icon’s name for the preview size button.device_width: An integer indicating the device’s width in pixels.label: A string for the aria label on the preview size button.
@property def preview_sizes(self): return [ { "name": "mobile", "icon": "mobile-icon", "device_width": 320, "label": "Preview in mobile size" }, # Add more preview size dictionaries as needed. ]
- default_preview_size¶
The default preview size name to use in live preview. Defaults to
"mobile", which is the first one defined inpreview_sizes. Ifpreview_sizesis empty, anIndexErrorwill be raised.
- serve_preview(request, mode_name)¶
Returns an HTTP response for use in object previews.
This method can be overridden to implement custom rendering and/or routing logic.
Any templates rendered during this process should use the
requestobject passed here - this ensures thatrequest.userand other properties are set appropriately for the wagtail user bar to be displayed/hidden. This request will always be a GET.
- get_parent(update=False)¶
- 반환:
the parent node of the current node object. Caches the result in the object itself to help in loops.
- get_children()¶
- 반환:
A queryset of all the node’s children
- get_ancestors(inclusive=False)¶
Returns a queryset of the current page’s ancestors, starting at the root page and descending to the parent, or to the current page itself if
inclusiveis true.
- get_descendants(inclusive=False)¶
Returns a queryset of all pages underneath the current page, any number of levels deep. If
inclusiveis true, the current page itself is included in the queryset.
- get_siblings(inclusive=True)¶
Returns a queryset of all other pages with the same parent as the current page. If
inclusiveis true, the current page itself is included in the queryset.
- get_translations(inclusive=False)¶
Returns a queryset containing the translations of this instance.
- get_translation(locale)¶
Finds the translation in the specified locale.
If there is no translation in that locale, this raises a
model.DoesNotExistexception.
- get_translation_or_none(locale)¶
Finds the translation in the specified locale.
If there is no translation in that locale, this returns
None.
- has_translation(locale)¶
Returns True if a translation exists in the specified locale.
- copy_for_translation(locale, copy_parents=False, alias=False, exclude_fields=None)¶
Creates a copy of this page in the specified locale.
- get_admin_default_ordering()¶
관리자 페이지 색인을 보고 검색 결과를 보지 않을 때 자식 페이지의 기본 정렬 순서를 반환합니다.
다음 정렬 순서를 사용할 수 있습니다.
'content_type''-content_type''latest_revision_created_at''-latest_revision_created_at''live''-live''ord''title''-title'
예를 들어, 페이지 수가 20개 미만인 경우에만 모든 자식 페이지에 대해 제목별로 페이지를 정렬하도록 합니다.
class BreadsIndexPage(Page): def get_admin_default_ordering(self): if Page.objects.child_of(self).count() < 20: return 'title' return self.admin_default_ordering
- admin_default_ordering¶
메서드
get_admin_default_ordering()에 대한 속성 버전으로, 기본값은'-latest_revision_created_at'입니다.
- localized¶
Finds the translation in the current active language.
If there is no translation in the active language, self is returned.
Note: This will not return the translation if it is in draft. If you want to include drafts, use the
.localized_draftattribute instead.
- localized_draft¶
Finds the translation in the current active language.
If there is no translation in the active language, self is returned.
Note: This will return translations that are in draft. If you want to exclude these, use the
.localizedattribute.
- subpage_types¶
이 페이지 유형의 자식으로 생성할 수 있는 페이지 모델 목록입니다. 예를 들어,
BlogIndex페이지는BlogPage를 자식으로 허용할 수 있지만JobPage는 허용하지 않습니다.class BlogIndex(Page): subpage_types = ['mysite.BlogPage', 'mysite.BlogArchivePage']
주어진 페이지에 대한 자식 페이지 생성을 완전히 차단하려면
subpage_types속성을 빈 배열로 설정합니다.class BlogPage(Page): subpage_types = []
- parent_page_types¶
부모 페이지 유형으로 허용되는 페이지 모델 목록입니다. 예를 들어,
BlogPage는BlogIndex페이지 아래에서만 생성할 수 있습니다.class BlogPage(Page): parent_page_types = ['mysite.BlogIndexPage']
페이지는
parent_page_types를 빈 배열로 설정하여 전혀 생성되지 않도록 할 수 있습니다(이는 한 번만 생성되어야 하는 고유한 페이지를 만드는 데 유용합니다).class HiddenPage(Page): parent_page_types = []
루트 페이지 아래에서만 페이지를 생성할 수 있도록 하려면(예:
HomePage모델의 경우)parent_page_type을['wagtailcore.Page']로 설정합니다.class HomePage(Page): parent_page_types = ['wagtailcore.Page']
- classmethod can_exist_under(parent)¶
Checks if this page type can exist as a subpage under a parent page instance.
See also:
Page.can_create_at()andPage.can_move_to()
- classmethod can_create_at(parent)¶
Checks if this page type can be created as a subpage under a parent page instance.
- can_move_to(parent)¶
Checks if this page instance can be moved to be a subpage of a parent page instance.
- get_route_paths()¶
Returns a list of paths that this page can be viewed at.
These values are combined with the dynamic portion of the page URL to automatically create redirects when the page’s URL changes.
참고
If using
RoutablePageMixin, you may want to override this method to include the paths of popular routes.참고
Redirect paths are ‘normalized’ to apply consistent ordering to GET parameters, so you don’t need to include every variation. Fragment identifiers are discarded too, so should be avoided.
- password_required_template¶
이 모델을 사용하는 보호된 페이지에 대한 로그인 폼을 렌더링하는 데 사용될 템플릿 파일을 정의합니다. 이는 설정에서
WAGTAIL_PASSWORD_REQUIRED_TEMPLATE을 사용하여 정의된 기본값을 재정의합니다. 비공개 페이지 를 참조하십시오.
- is_creatable¶
이 페이지를 Wagtail 관리를 통해 생성할 수 있는지 여부를 제어합니다. 기본값은
True이며, 서브클래스에 의해 상속되지 않습니다. 이는 multi-table inheritance 를 사용할 때 기본 모델이 실제 페이지로 생성되는 것을 막는 데 유용합니다.
- max_count¶
Wagtail 관리 인터페이스를 통해 생성할 수 있는 이 유형의 최대 페이지 수를 제어합니다. 이는 “이러한 페이지를 최대 3개까지 허용”해야 하거나 단일 페이지에 유용합니다.
- max_count_per_parent¶
단일 부모 페이지 아래에서 생성할 수 있는 이 유형의 최대 페이지 수를 제어합니다.
- private_page_options¶
페이지 유형에 사용할 수 있는 개인 정보 옵션을 제어합니다.
다음 옵션을 사용할 수 있습니다.
'password'- 공유 암호를 사용하여 제한할 수 있습니다.'groups'- 특정 그룹의 사용자로 제한할 수 있습니다.'login'- 로그인한 사용자로 제한할 수 있습니다.
class BreadPage(Page): ... # 기본값 private_page_options = ['password', 'groups', 'login'] # 공유 암호 비활성화 private_page_options = ['groups', 'login'] # 공유 암호만 private_page_options = ['password'] # 이 페이지 모델에 대한 개인 정보 옵션 없음 private_page_options = []
- exclude_fields_in_copy¶
페이지가 복사될 때 포함되지 않을 필드 이름 배열입니다.
ClusterableModel을 사용하지 않거나 복사해서는 안 되는 관계가 있는 경우 유용합니다.class BlogPage(Page): exclude_fields_in_copy = ['special_relation', 'custom_uuid']
다음 필드는 복사 시 항상 제외됩니다. -
['id', 'path', 'depth', 'numchild', 'url_path', 'path'].
- base_form_class¶
이 유형의 페이지를 Wagtail 페이지 편집기에서 편집하는 데 기본으로 사용되는 폼 클래스입니다. 이 속성은 모델에 설정하여 페이지 편집기 폼을 사용자 지정할 수 있습니다. 폼은
WagtailAdminPageForm의 서브클래스여야 합니다. 자세한 내용은 생성된 양식 사용자 정의 를 참조하십시오.
- with_content_json(content)¶
Returns a new version of the page with field values updated to reflect changes in the provided
content(which usually comes from a previously-saved page revision).Certain field values are preserved in order to prevent errors if the returned page is saved, such as
id,content_typeand some tree-related values. The following field values are also preserved, as they are considered to be meaningful to the page as a whole, rather than to a specific revision:draft_titlelivehas_unpublished_changesownerlockedlocked_bylocked_atlatest_revisionlatest_revision_created_atfirst_published_atalias_ofwagtail_admin_comments(COMMENTS_RELATION_NAME)
- save(clean=True, user=None, log_action=False, **kwargs)¶
Writes the page to the database, performing additional housekeeping tasks to ensure data integrity:
locale,draft_titleandslugare set to default values if not provided, withslugbeing generated from the title with a suffix to ensure uniqueness within the parent page where necessaryThe
url_pathfield is set based on theslugand the parent pageIf the
slughas changed, theurl_pathof this page and all descendants is updated and a page_slug_changed signal is sent
New pages should be saved by passing the unsaved page instance to the
add_child()oradd_sibling()method of an existing page, which will correctly update the fields responsible for tracking the page’s location in the tree.If
clean=Falseis passed, the page is saved without validation. This is appropriate for updates that only change metadata such as latest_revision while keeping content and page location unchanged.If
clean=Trueis passed (the default), and the page haslive=Trueset, the page is validated usingfull_clean()before saving.If
clean=Trueis passed, and the page haslive=Falseset, only the title and slug fields are validated.버전 7.0에서 변경:
clean=Truenow only performs full validation when the page is live. When the page is not live, only the title and slug fields are validated. Previously, full validation was always performed.
- copy(recursive=False, to=None, update_attrs=None, copy_revisions=True, keep_live=True, user=None, process_child_object=None, exclude_fields=None, log_action='wagtail.copy', reset_translation_key=True)¶
Copies a given page
- 매개변수:
log_action – flag for logging the action. Pass None to skip logging. Can be passed an action string. Defaults to
'wagtail.copy'.
- move(new_parent, pos=None)¶
페이지와 모든 하위 페이지를 새 부모로 이동합니다. 자세한 내용은
django-treebeard를 참조하십시오.
- create_alias(*, recursive=False, parent=None, update_slug=None, update_locale=None, user=None, log_action='wagtail.create_alias', reset_translation_key=True, _mpnode_attrs=None)¶
- update_aliases(*, revision=None, _content=None, _updated_ids=None)¶
Publishes all aliases that follow this page with the latest content from this page.
This is called by Wagtail whenever a page with aliases is published.
- 매개변수:
revision (Revision, Optional) – The revision of the original page that we are updating to (used for logging purposes)
- get_cache_key_components()¶
The components of a
Pagewhich make up thecache_key. Any change to a page should be reflected in a change to at least one of these components.
- cache_key¶
A generic cache key to identify a page in its current state. Should the page change, so will the key.
Customizations to the cache key should be made in
get_cache_key_components.
Site¶
Site 모델은 서버가 응답하는 각 호스트 이름에 대해 트리의 어떤 부분을 사용할지 관리자가 구성할 수 있도록 하므로 다중 사이트 설치에 유용합니다.
find_for_request() 함수는 주어진 HTTP 요청을 처리할 Site 객체를 반환합니다.
데이터베이스 필드¶
- class wagtail.models.Site¶
- hostname¶
(텍스트)
스키마, 포트 및 경로를 제외한 사이트의 호스트 이름입니다.
예:
www.mysite.com참고
사이트의 루트 URL을 가져오는 방법을 찾고 있다면
root_url속성을 사용하십시오.
- port¶
(숫자)
사이트가 응답하는 포트 번호입니다.
- site_name¶
(텍스트 - 선택 사항)
사이트의 사람이 읽을 수 있는 이름입니다. Wagtail 자체에서는 사용되지 않지만,
<title>요소와 같이 사이트 프런트엔드에서 사용하기에 적합합니다.예:
Rod의 새 세상
- is_default_site¶
(부울)
사이트가 기본값인 경우
True로 설정됩니다. 하나의 사이트만 기본값이 될 수 있습니다.기본 사이트는 필요한 호스트 이름/포트를 가진 사이트를 찾을 수 없는 경우 대체로 사용됩니다.
메서드 및 속성¶
- class wagtail.models.Site
- static find_for_request(request)¶
Find the site object responsible for responding to this HTTP request object. Try:
unique hostname first
then hostname and port
if there is no matching hostname at all, or no matching hostname:port combination, fall back to the unique default site, or raise an exception
NB this means that high-numbered ports on an extant hostname may still be routed to a different hostname which is set as the default
The site will be cached via request._wagtail_site
- root_url¶
이것은 사이트의 URL을 반환합니다.
hostname및port필드에서 계산됩니다.URL의 스키마 부분은
port필드의 값에 따라 계산됩니다.80 =
http://443 =
https://다른 모든 것은
http://스키마를 사용하며 포트는 호스트 이름 끝에 추가됩니다(예:http://mysite.com:8000/)
- static get_site_root_paths()¶
Return a list of SiteRootPath instances, most specific path first - used to translate url_paths into actual URLs with hostnames.
Each root path is an instance of the SiteRootPath named tuple, and have the following attributes:
site_id- The ID of the Site recordroot_path- The internal URL path of the site’s home page (for example ‘/home/’)root_url- The scheme/domain name of the site (for example ‘https://www.example.com/’)language_code- The language code of the site (for example ‘en’)
Locale¶
Locale 모델은 사이트에서 사용할 수 있는 언어 및/또는 로케일 세트를 정의합니다.
각 Locale 레코드는 WAGTAIL_CONTENT_LANGUAGES 설정에 정의된 “언어 코드”에 해당합니다.
Wagtail은 처음에 모든 기존 콘텐츠에 대한 기본 언어로 하나의 Locale 을 설정합니다.
이 첫 번째 로케일은 LANGUAGE_CODE 에 정의된 사이트 기본 언어 코드와 가장 일치하는 WAGTAIL_CONTENT_LANGUAGES 의 값을 자동으로 선택합니다.
기본 언어 코드가 나중에 변경되면 Wagtail은 새 Locale 레코드를 자동으로 만들거나 기존 레코드를 업데이트하지 않습니다.
국제화가 활성화되기 전에 모든 페이지는 이 기본 Locale 레코드를 사용합니다.
이는 데이터베이스 제약 조건을 충족하고 나중에 국제화를 더 쉽게 켤 수 있도록 하기 위함입니다.
WAGTAIL_CONTENT_LANGUAGES 변경¶
WAGTAIL_CONTENT_LANGUAGES 에서 언어를 추가하거나 제거할 수 있습니다.
WAGTAIL_CONTENT_LANGUAGES 에서 옵션을 제거하기 전에 Locale
레코드를 다른 콘텐츠 언어를 사용하도록 업데이트하거나 삭제하는 것이 중요합니다.
유효하지 않은 콘텐츠 언어를 가진 Locale 인스턴스는 모든
데이터베이스 쿼리에서 자동으로 필터링되어 편집하거나 볼 수 없게 됩니다.
메서드 및 속성¶
- class wagtail.models.Locale¶
- language_code¶
The language code that represents this locale
The language code can either be a language code on its own (such as
en,fr), or it can include a region code (such asen-gb,fr-fr).
- classmethod get_default()¶
Returns the default Locale based on the site’s
LANGUAGE_CODEsetting.
- classmethod get_active()¶
Returns the Locale that corresponds to the currently activated language in Django.
- language_name¶
Uses data from
django.conf.localeto return the language name in English. For example, if the object’slanguage_codewere"fr", the return value would be"French".Raises
KeyErrorifdjango.conf.localehas no information for the object’slanguage_codevalue.
- language_name_local¶
Uses data from
django.conf.localeto return the language name in the language itself. For example, if thelanguage_codewere"fr"(French), the return value would be"français".Raises
KeyErrorifdjango.conf.localehas no information for the object’slanguage_codevalue.
- language_name_localized¶
Uses data from
django.conf.localeto return the language name in the currently active language. For example, iflanguage_codewere"fr"(French), and the active language were"da"(Danish), the return value would be"Fransk".Raises
KeyErrorifdjango.conf.localehas no information for the object’slanguage_codevalue.
- is_default¶
Returns a boolean indicating whether this object is the default locale.
- is_active¶
Returns a boolean indicating whether this object is the currently active locale.
- is_bidi¶
Returns a boolean indicating whether the language is bi-directional.
TranslatableMixin¶
TranslatableMixin 은 번역 가능하도록 모든 비페이지 Django 모델에 추가할 수 있는 추상 모델입니다.
페이지에는 이미 이 믹스인이 포함되어 있으므로 추가할 필요가 없습니다.
관리자에서 비페이지 모델을 번역 가능하게 하려면 스니펫으로 등록해야 합니다. 번역 가능한 스니펫도 참조하십시오.
데이터베이스 필드¶
- class wagtail.models.TranslatableMixin¶
- locale¶
(
wagtail.models.Locale에 대한 외래 키)페이지의 경우 부모 페이지의 로케일로 기본 설정됩니다.
- translation_key¶
(uuid)
새 모델 인스턴스가 생성될 때마다 무작위로 생성되는 UUID입니다. 이는 해당 인스턴스의 모든 번역과 공유되므로 번역을 쿼리하는 데 사용할 수 있습니다.
translation_key 및 locale 필드에는 객체가 한 언어로 두 번 이상 번역되는 것을 방지하기 위한 고유 키 제약 조건이 있습니다.
참고
이는 현재 TranslatableMixin.Meta 의 unique_together 를 통해 강제되지만, 향후 TranslatableMixin.Meta.constraints 의 UniqueConstraint 로 대체될 수 있습니다.
모델이 Meta 클래스를 정의하는 경우(새 정의 또는 TranslatableMixin.Meta 를 명시적으로 상속하는 경우), unique_together 또는 constraints 를 설정할 때 주의하십시오. translation_key 및 locale 에 unique_together 또는 UniqueConstraint(둘 다 아님)가 있는지 확인하십시오. 이에 대한 시스템 검사가 있습니다.
메서드 및 속성¶
- class wagtail.models.TranslatableMixin
- get_translations(inclusive=False)¶
Returns a queryset containing the translations of this instance.
- get_translation(locale)¶
Finds the translation in the specified locale.
If there is no translation in that locale, this raises a
model.DoesNotExistexception.
- get_translation_or_none(locale)¶
Finds the translation in the specified locale.
If there is no translation in that locale, this returns
None.
- has_translation(locale)¶
Returns True if a translation exists in the specified locale.
- copy_for_translation(locale, exclude_fields=None)¶
Creates a copy of this instance with the specified locale.
Note that the copy is initially unsaved.
- classmethod get_translation_model()¶
Returns this model’s “Translation model”.
The “Translation model” is the model that has the
localeandtranslation_keyfields. Typically this would be the current model, but it may be a super-class if multi-table inheritance is in use (as is the case forwagtailcore.Page).
- localized¶
Finds the translation in the current active language.
If there is no translation in the active language, self is returned.
Note: This will not return the translation if it is in draft. If you want to include drafts, use the
.localized_draftattribute instead.
PreviewableMixin¶
PreviewableMixin 은 인스턴스를 미리 볼 수 있도록 모든 비페이지 Django 모델에 추가할 수 있는 믹스인 클래스입니다.
페이지에는 이미 이 믹스인이 포함되어 있으므로 추가할 필요가 없습니다.
관리자에서 비페이지 모델을 미리 볼 수 있게 하려면 스니펫으로 등록해야 합니다. 스니펫 미리 보기 가능하게 만들기도 참조하십시오.
메서드 및 속성¶
- class wagtail.models.PreviewableMixin¶
- preview_modes¶
A list of
(internal_name, display_name)tuples for the modes in which this object can be displayed for preview/moderation purposes. Ordinarily an object will only have one display mode, but subclasses can override this - for example, a page containing a form might have a default view of the form, and a post-submission ‘thank you’ page. Set to[]to completely disable previewing for this model.
- default_preview_mode¶
The default preview mode to use in live preview. This default is also used in areas that do not give the user the option of selecting a mode explicitly, e.g. in the moderator approval workflow. If
preview_modesis empty, anIndexErrorwill be raised.
- preview_sizes¶
A list of dictionaries, each representing a preview size option for this object. Override this property to customize the preview sizes. Each dictionary in the list should include the following keys:
name: A string representing the internal name of the preview size.icon: A string specifying the icon’s name for the preview size button.device_width: An integer indicating the device’s width in pixels.label: A string for the aria label on the preview size button.
@property def preview_sizes(self): return [ { "name": "mobile", "icon": "mobile-icon", "device_width": 320, "label": "Preview in mobile size" }, # Add more preview size dictionaries as needed. ]
- default_preview_size¶
The default preview size name to use in live preview. Defaults to
"mobile", which is the first one defined inpreview_sizes. Ifpreview_sizesis empty, anIndexErrorwill be raised.
- is_previewable()¶
Returns
Trueif at least one preview mode is specified inpreview_modes.
- get_preview_context(request, mode_name)¶
Returns a context dictionary for use in templates for previewing this object.
- get_preview_template(request, mode_name)¶
Returns a template to be used when previewing this object.
Subclasses of
PreviewableMixinmust override this method to return the template name to be used in the preview. Alternatively, subclasses can also override theserve_previewmethod to completely customise the preview rendering logic.
- serve_preview(request, mode_name)¶
Returns an HTTP response for use in object previews.
This method can be overridden to implement custom rendering and/or routing logic.
Any templates rendered during this process should use the
requestobject passed here - this ensures thatrequest.userand other properties are set appropriately for the wagtail user bar to be displayed/hidden. This request will always be a GET.
RevisionMixin¶
RevisionMixin 은 인스턴스의 개정을 저장할 수 있도록 모든 비페이지 Django 모델에 추가할 수 있는 추상 모델입니다.
페이지에는 이미 이 믹스인이 포함되어 있으므로 추가할 필요가 없습니다.
관리자에서 비페이지 모델을 개정 가능하게 하려면 스니펫으로 등록해야 합니다. 스니펫 개정 저장도 참조하십시오.
데이터베이스 필드¶
메서드 및 속성¶
- class wagtail.models.RevisionMixin
- _revisions¶
A default
GenericRelationfor the purpose of automatically deleting revisions when the object is deleted. This is not used to query the object’s revisions. Instead, therevisions()property is used for that purpose. As such, this default relation is considered private.This
GenericRelationdoes not have arelated_query_name, so it cannot be used for reverse-related queries fromRevisionback to this model. If the feature is desired, subclasses can define their ownGenericRelationtoRevisionwith a customrelated_query_name.Added in version 7.1: The default
GenericRelation_revisionswas added.
- revisions¶
Returns revisions that belong to the object. For non-page models, this is done by querying the
Revisionmodel directly rather than using aGenericRelation, to avoid a known limitation in Django for models with multi-table inheritance where the relation’s content type may not match the instance’s type.
- save_revision(user=None, approved_go_live_at=None, changed=True, log_action=False, previous_revision=None, clean=True)¶
Creates and saves a revision.
- 매개변수:
user – The user performing the action.
approved_go_live_at – The date and time the revision is approved to go live.
changed – Indicates whether there were any content changes.
log_action – Flag for logging the action. Pass
Trueto also create a log entry. Can be passed an action string. Defaults to"wagtail.edit"when noprevious_revisionparam is passed, otherwise"wagtail.revert".previous_revision (Revision) – Indicates a revision reversal. Should be set to the previous revision instance.
clean – Set this to
Falseto skip cleaning object content before saving this revision.
- 반환:
The newly created revision.
- get_latest_revision_as_object()¶
Returns the latest revision of the object as an instance of the model. If no latest revision exists, returns the object itself.
- with_content_json(content)¶
Returns a new version of the object with field values updated to reflect changes in the provided
content(which usually comes from a previously-saved revision).Certain field values are preserved in order to prevent errors if the returned object is saved, such as
id. The following field values are also preserved, as they are considered to be meaningful to the object as a whole, rather than to a specific revision:latest_revision
If
TranslatableMixinis applied, the following field values are also preserved:translation_keylocale
DraftStateMixin¶
DraftStateMixin 은 인스턴스에 게시되지 않은 변경 사항을 허용하도록 모든 비페이지 Django 모델에 추가할 수 있는 추상 모델입니다.
이 믹스인은 RevisionMixin 이 적용되어야 합니다. 페이지에는 이미 이 믹스인이 포함되어 있으므로 추가할 필요가 없습니다.
관리자에서 비페이지 모델에 게시 기능이 있도록 하려면 스니펫으로 등록해야 합니다. 스니펫 초안 변경 사항 저장도 참조하십시오.
데이터베이스 필드¶
- class wagtail.models.DraftStateMixin¶
- live¶
(부울)
객체가 게시된 경우
True로 설정되는 부울입니다.참고: 이 필드는 기본적으로
True로 설정되어 프로그래밍 방식으로 생성된 모든 객체가 기본적으로 게시됩니다.
- has_unpublished_changes¶
(부울)
객체가 초안이거나 초안 변경 사항과 함께 게시된 경우
True로 설정되는 부울입니다.
- first_published_at¶
(날짜/시간)
객체가 처음 게시된 날짜/시간입니다.
- last_published_at¶
(날짜/시간)
객체가 마지막으로 게시된 날짜/시간입니다.
메서드 및 속성¶
- class wagtail.models.DraftStateMixin
- publish(revision, user=None, changed=True, log_action=True, previous_revision=None, skip_permission_checks=False)¶
Publish a revision of the object by applying the changes in the revision to the live object.
- 매개변수:
revision (Revision) – Revision to publish.
user – The publishing user.
changed – Indicated whether content has changed.
log_action – Flag for the logging action, pass
Falseto skip logging.previous_revision (Revision) – Indicates a revision reversal. Should be set to the previous revision instance.
- unpublish(set_expired=False, commit=True, user=None, log_action=True)¶
Unpublish the live object.
- 매개변수:
set_expired – Mark the object as expired.
commit – Commit the changes to the database.
user – The unpublishing user.
log_action – Flag for the logging action, pass
Falseto skip logging.
- with_content_json(content)¶
Similar to
RevisionMixin.with_content_json(), but with the following fields also preserved:livehas_unpublished_changesfirst_published_at
LockableMixin¶
LockableMixin 은 인스턴스를 잠글 수 있도록 모든 비페이지 Django 모델에 추가할 수 있는 추상 모델입니다.
페이지에는 이미 이 믹스인이 포함되어 있으므로 추가할 필요가 없습니다. 자세한 내용은 스니펫 잠금를 참조하십시오.
관리자에서 비페이지 모델을 잠금 가능하게 하려면 스니펫으로 등록해야 합니다. 스니펫 잠금도 참조하십시오.
데이터베이스 필드¶
메서드 및 속성¶
- class wagtail.models.LockableMixin
- get_lock()¶
Returns a sub-class of
BaseLockif the instance is locked, otherwiseNone.
- with_content_json(content)¶
Similar to
RevisionMixin.with_content_json(), but with the following fields also preserved:lockedlocked_atlocked_by
WorkflowMixin¶
WorkflowMixin 은 인스턴스를 워크플로에 제출할 수 있도록 모든 비페이지 Django 모델에 추가할 수 있는 믹스인 클래스입니다.
이 믹스인은 RevisionMixin 및 DraftStateMixin 이 적용되어야 합니다. 페이지에는 이미 이 믹스인이 포함되어 있으므로 추가할 필요가 없습니다. 자세한 내용은 스니펫에 워크플로 활성화를 참조하십시오.
관리자에서 비페이지 모델에 워크플로 기능이 있도록 하려면 스니펫으로 등록해야 합니다. 스니펫에 워크플로 활성화도 참조하십시오.
메서드 및 속성¶
- class wagtail.models.WorkflowMixin¶
- classmethod get_default_workflow()¶
Returns the active workflow assigned to the model.
For non-
Pagemodels, workflows are assigned to the model’s content type, thus shared across all instances instead of being assigned to individual instances (unlessget_workflow()is overridden).This method is used to determine the workflow to use when creating new instances of the model. On
Pagemodels, this method is unused as the workflow can be determined from the parent page’s workflow.
- has_workflow¶
Returns
`True`if the object has an active workflow assigned, otherwise`False`.
- get_workflow()¶
Returns the active workflow assigned to the object.
- _workflow_states¶
A default
GenericRelationfor the purpose of automatically deleting workflow states when the object is deleted. This is not used to query the object’s workflow states. Instead, theworkflow_states()property is used for that purpose. As such, this default relation is considered private.This
GenericRelationdoes not have arelated_query_name, so it cannot be used for reverse-related queries fromWorkflowStateback to this model. If the feature is desired, subclasses can define their ownGenericRelationtoWorkflowStatewith a customrelated_query_name.Added in version 7.1: The default
GenericRelation_workflow_stateswas added.
- workflow_states¶
Returns workflow states that belong to the object. For non-page models, this is done by querying the
WorkflowStatemodel directly rather than using aGenericRelation, to avoid a known limitation in Django for models with multi-table inheritance where the relation’s content type may not match the instance’s type.
- workflow_in_progress¶
Returns
`True`if a workflow is in progress on the current object, otherwise`False`.
- current_workflow_state¶
Returns the in progress or needs changes workflow state on this object, if it exists.
- current_workflow_task_state¶
Returns (specific class of) the current task state of the workflow on this object, if it exists.
- current_workflow_task¶
Returns (specific class of) the current task in progress on this object, if it exists.
Revision¶
페이지가 편집될 때마다 새 Revision 이 생성되어 데이터베이스에 저장됩니다. 이는 페이지에 대한 모든 변경 사항의 전체 기록을 찾는 데 사용할 수 있으며, 새 변경 사항이 라이브로 전환되기 전에 보관할 장소도 제공합니다.
개정은
RevisionMixin의 인스턴스에서save_revision()메서드를 호출하여 생성할 수 있습니다.페이지의 내용은 JSON 직렬화 가능하며
content필드에 저장됩니다.as_object()메서드를 호출하여 객체의 모델 인스턴스로Revision을 검색할 수 있습니다.
더 이상 사용되지 않는 오래된 개정을 삭제하려면 purge_revisions 명령을 사용할 수 있습니다.
데이터베이스 필드¶
- class wagtail.models.Revision¶
- content_object¶
(제네릭 외래 키)
이 개정이 속한 객체입니다. 페이지 개정의 경우 객체는 특정 클래스의 인스턴스입니다.
- content_type¶
(
ContentType에 대한 외래 키)이 개정이 속한 객체의 콘텐츠 유형입니다. 페이지 개정의 경우 특정 페이지 유형의 콘텐츠 유형을 의미합니다.
- base_content_type¶
(
ContentType에 대한 외래 키)이 개정이 속한 객체의 기본 콘텐츠 유형입니다. 페이지 개정의 경우
Page모델의 콘텐츠 유형을 의미합니다.
- object_id¶
(문자열)
이 개정이 속한 객체의 기본 키입니다.
- created_at¶
(날짜/시간)
개정이 생성된 시간입니다.
- user¶
(사용자 모델에 대한 외래 키)
개정을 만든 사용자입니다.
- content¶
(사전)
개정이 생성될 당시 객체의 JSON 콘텐츠입니다.
관리자¶
- class wagtail.models.Revision
- objects¶
이 기본 관리자는 데이터베이스의 모든
Revision객체를 검색하는 데 사용됩니다. 또한 특정 객체의 개정을 쿼리할 수 있는wagtail.models.RevisionsManager.for_instance메서드를 제공합니다.예시:
Revision.objects.all() Revision.objects.for_instance(my_object)
- page_revisions¶
이 관리자는 기본 관리자를 확장하며 페이지에 속하는 모든
Revision객체를 검색하는 데 사용됩니다.예시:
Revision.page_revisions.all()
메서드 및 속성¶
- class wagtail.models.Revision
-
- is_latest_revision()¶
이 개정이 객체의 최신 개정인 경우
True를 반환합니다.
- publish(user=None, changed=True, log_action=True, previous_revision=None, skip_permission_checks=False)¶
이것을 호출하면 이 개정의 내용이 라이브 객체로 복사됩니다. 객체가 초안인 경우 게시됩니다.
- base_content_object¶
이 속성은 이 개정이 속한 객체를 기본 클래스의 인스턴스로 반환합니다.
GroupPagePermission¶
데이터베이스 필드¶
PageViewRestriction¶
데이터베이스 필드¶
Orderable (추상)¶
데이터베이스 필드¶
Workflow¶
워크플로는 작업이 객체에 대해 수행되려면(일반적으로 게시) 승인되어야 하는 작업 시퀀스를 나타냅니다.
데이터베이스 필드¶
메서드 및 속성¶
- class wagtail.models.Workflow
- start(obj, user)¶
Initiates a workflow by creating an instance of
WorkflowState.
- tasks¶
Returns all
Taskinstances linked to this workflow.
- deactivate(user=None)¶
Sets the workflow as inactive, and cancels all in progress instances of
WorkflowStatelinked to this workflow.
- all_pages()¶
Returns a queryset of all the pages that this Workflow applies to.
WorkflowState¶
워크플로 상태는 객체에서 시작된 워크플로의 상태를 나타냅니다.
데이터베이스 필드¶
- class wagtail.models.WorkflowState¶
- content_object¶
(제네릭 외래 키)
워크플로가 시작된 객체입니다. 페이지 워크플로의 경우 객체는 기본
Page모델의 인스턴스입니다.
- content_type¶
(
ContentType에 대한 외래 키)이 워크플로 상태가 속한 객체의 콘텐츠 유형입니다. 페이지 워크플로의 경우 특정 페이지 유형의 콘텐츠 유형을 의미합니다.
- base_content_type¶
(
ContentType에 대한 외래 키)이 워크플로 상태가 속한 객체의 기본 콘텐츠 유형입니다. 페이지 워크플로의 경우
Page모델의 콘텐츠 유형을 의미합니다.
- object_id¶
(문자열)
이 개정이 속한 객체의 기본 키입니다.
- workflow¶
(
Workflow에 대한 외래 키)WorkflowState가 나타내는 상태인 워크플로입니다.
- status¶
(텍스트)
워크플로의 현재 상태(옵션은
TaskState.STATUS_CHOICES)입니다.
- created_at¶
(날짜/시간)
이
WorkflowState인스턴스가 생성된 시점 - 워크플로가 시작된 시점
- requested_by¶
(사용자 모델에 대한 외래 키)
이 워크플로를 시작한 사용자입니다.
- current_task_state¶
(
TaskState에 대한 외래 키)워크플로가 현재 있는 작업에 대한
TaskState모델: 완료 중(진행 중인 경우) 또는 최종 작업 상태(완료된 경우)
메서드 및 속성¶
- class wagtail.models.WorkflowState
- STATUS_CHOICES¶
status필드에 대한 가능한 옵션과 해당 상세 이름의 튜플입니다. 옵션은STATUS_IN_PROGRESS,STATUS_APPROVED,STATUS_CANCELLED,STATUS_REJECTED및STATUS_SKIPPED입니다.
- update(user=None, next_task=None)¶
Checks the status of the current task, and progresses (or ends) the workflow if appropriate. If the workflow progresses, next_task will be used to start a specific task next if provided.
- get_next_task()¶
Returns the next active task, which has not been either approved or skipped.
- cancel(user=None)¶
Cancels the workflow state
- finish(user=None)¶
Finishes a successful in progress workflow, marking it as approved and performing the
on_finishaction.
- resume(user=None)¶
Put a STATUS_NEEDS_CHANGES workflow state back into STATUS_IN_PROGRESS, and restart the current task
- copy_approved_task_states_to_revision(revision)¶
Creates copies of previously approved task states with revision set to a different revision.
- all_tasks_with_status()¶
Returns a list of Task objects that are linked with this workflow state’s workflow. The status of that task in this workflow state is annotated in the
.statusfield. And a displayable version of that status is annotated in the.status_displayfield.This is different to querying TaskState as it also returns tasks that haven’t been started yet (so won’t have a TaskState).
- revisions()¶
Returns all revisions associated with task states linked to the current workflow state.
Task¶
작업은 워크플로가 성공적으로 완료되려면 승인되어야 하는 워크플로의 단계를 나타냅니다.
데이터베이스 필드¶
- class wagtail.models.Task¶
- name¶
(텍스트)
작업의 사람이 읽을 수 있는 이름입니다.
- active¶
(부울)
작업이 활성 상태인지 여부: 활성 워크플로는 워크플로에 추가하고 시작할 수 있습니다. 비활성 워크플로는 추가할 수 없으며, 기존 워크플로에 있는 경우 건너뜁니다.
- content_type¶
(
ContentType에 대한 외래 키)이 작업의 특정 모델을 나타내는
ContentType객체에 대한 외래 키입니다.
메서드 및 속성¶
- class wagtail.models.Task
- workflows¶
Returns all
Workflowinstances that use this task.
- active_workflows¶
Return a
QuerySet`of active workflows that this task is part of.
- task_state_class¶
이 작업에 대한 상태 정보를 저장하기 위해 생성할 특정 작업 상태 클래스입니다. 지정되지 않은 경우
TaskState가 됩니다.
- classmethod get_verbose_name()¶
Returns the human-readable “verbose name” of this task model e.g “Group approval task”.
- specific¶
Returns this object in its most specific subclassed form with all field values fetched from the database. The result is cached in memory.
- start(workflow_state, user=None)¶
Start this task on the provided workflow state by creating an instance of TaskState.
- on_action(task_state, user, action_name, **kwargs)¶
Performs an action on a task state determined by the
action_namestring passed.
- user_can_access_editor(obj, user)¶
Returns
Trueif a user who would not normally be able to access the editor for the object should be able to if the object is currently on this task. Note that returningFalsedoes not remove permissions from users who would otherwise have them.
- user_can_lock(obj, user)¶
Returns
Trueif a user who would not normally be able to lock the object should be able to if the object is currently on this task. Note that returningFalsedoes not remove permissions from users who would otherwise have them.
- user_can_unlock(obj, user)¶
Returns
Trueif a user who would not normally be able to unlock the object should be able to if the object is currently on this task. Note that returningFalsedoes not remove permissions from users who would otherwise have them.
- locked_for_user(obj, user)¶
Returns
Trueif the object should be locked to a given user’s edits. This can be used to prevent editing by non-reviewers.
- get_actions(obj, user)¶
Get the list of action strings (name, verbose_name, whether the action requires additional data - see
get_form_for_action) for actions the current user can perform for this task on the given object. These strings should be the same as those able to be passed toon_action.
- get_task_states_user_can_moderate(user, **kwargs)¶
Returns a
QuerySetof the task states the current user can moderate
- deactivate(user=None)¶
Set
activeto False and cancel all in progress task states linked to this task.
- get_form_for_action(action)¶
- get_template_for_action(action)¶
Specifies a template for the workflow action modal.
- classmethod get_description()¶
Returns the task description.
TaskState¶
작업 상태는 특정 개정에서 작업 진행 상황에 대한 상태 정보를 저장합니다.
데이터베이스 필드¶
- class wagtail.models.TaskState¶
- workflow_state¶
(
WorkflowState에 대한 외래 키)이 작업 상태를 시작한 워크플로 상태입니다.
- status¶
(텍스트)
이 개정에서 작업의 완료 상태입니다. 옵션은
TaskState.STATUS_CHOICES에서 사용할 수 있습니다.
- content_type¶
(
ContentType에 대한 외래 키)이 작업의 특정 모델을 나타내는
ContentType객체에 대한 외래 키입니다.
- started_at¶
(날짜/시간)
이 작업 상태가 생성된 시점입니다.
- finished_at¶
(날짜/시간)
이 작업 상태가 취소, 거부 또는 승인된 시점입니다.
- finished_by¶
(사용자 모델에 대한 외래 키)
작업을 완료(취소, 거부, 승인)한 사용자입니다.
- comment¶
(텍스트)
작업이 완료될 때 사용자가 일반적으로 추가하는 텍스트 주석입니다.
메서드 및 속성¶
- class wagtail.models.TaskState
- STATUS_CHOICES¶
status필드에 대한 가능한 옵션과 해당 상세 이름의 튜플입니다. 옵션은STATUS_IN_PROGRESS,STATUS_APPROVED,STATUS_CANCELLED,STATUS_REJECTED및STATUS_SKIPPED입니다.
- exclude_fields_in_copy¶
TaskState.copy()메서드가 호출될 때 복사되지 않을 필드 목록입니다.
- specific¶
Returns this object in its most specific subclassed form with all field values fetched from the database. The result is cached in memory.
- approve(user=None, update=True, comment='')¶
Approve the task state and update the workflow state.
- reject(user=None, update=True, comment='')¶
Reject the task state and update the workflow state.
- task_type_started_at¶
Finds the first chronological started_at for successive TaskStates - ie started_at if the task had not been restarted.
- cancel(user=None, resume=False, comment='')¶
Cancel the task state and update the workflow state. If
resumeis set to True, then upon update the workflow state is passed the current task asnext_task, causing it to start a new task state on the current task if possible.
- copy(update_attrs=None, exclude_fields=None)¶
Copy this task state, excluding the attributes in the
exclude_fieldslist and updating any attributes to values specified in theupdate_attrsdictionary ofattribute:new valuepairs.
- get_comment()¶
Returns a string that is displayed in workflow history.
This could be a comment by the reviewer, or generated. Use mark_safe to return HTML.
WorkflowTask¶
특정 워크플로에서 작업의 순서를 나타냅니다.
데이터베이스 필드¶
WorkflowPage¶
워크플로를 페이지 및 해당 하위 페이지에 할당하는 것을 나타냅니다.
데이터베이스 필드¶
WorkflowContentType¶
워크플로를 Django 모델에 할당하는 것을 나타냅니다.
데이터베이스 필드¶
- class wagtail.models.WorkflowContentType¶
-
- content_type¶
(
ContentType에 대한 외래 키)워크플로에 할당된 모델을 나타내는
ContentType객체에 대한 외래 키입니다.
BaseLogEntry¶
객체에 대해 수행된 작업 기록을 나타내는 추상 기본 클래스입니다.
데이터베이스 필드¶
- class wagtail.models.BaseLogEntry¶
- content_type¶
(
ContentType에 대한 외래 키)이 모델의 특정 모델을 나타내는
ContentType객체에 대한 외래 키입니다.
- label¶
(텍스트)
항목 생성 시 객체 제목
참고: Wagtail은
LogEntryManager.log_action에 전달된 객체의get_admin_display_title또는 문자열 표현을 사용하려고 시도합니다.
- user¶
(사용자 모델에 대한 외래 키)
작업을 트리거한 사용자에 대한 외래 키입니다.
- data¶
(사전)
각 작업에 대한 추가 세부 정보의 JSON 표현입니다. 예를 들어, 페이지에서 복사할 때 원본 페이지 ID 및 제목. 또는 워크플로 전환 시 워크플로 ID/이름 및 다음 단계 ID/이름
- timestamp¶
(날짜/시간)
항목이 생성된 날짜/시간입니다.
- content_changed¶
(부울)
콘텐츠가 변경된 경우
True로 설정할 수 있는 부울입니다.
- deleted¶
(부울)
객체가 삭제된 경우
True로 설정할 수 있는 부울입니다. 사이트 기록 보고서에서 항목을 필터링하는 데 사용됩니다.
메서드 및 속성¶
PageLogEntry¶
Page 에 대해 수행된 작업 기록을 나타내며, BaseLogEntry 를 서브클래스합니다.
데이터베이스 필드¶
Comment¶
페이지에 대한 주석을 나타냅니다.
데이터베이스 필드¶
- class wagtail.models.Comment¶
-
- user¶
(사용자 모델에 대한 외래 키)
이 주석을 추가한 사용자에 대한 외래 키입니다.
- text¶
(텍스트)
주석의 텍스트 내용입니다.
- contentpath¶
(텍스트)
주석이 첨부된 필드 또는 스트림필드 블록의 경로로,
field또는field.streamfield_block_id형식입니다.
- position¶
(텍스트)
필드 내 주석 위치에 대한 식별자입니다. 사용되는 형식은 필드에 따라 결정됩니다.
- created_at¶
(날짜/시간)
주석이 생성된 날짜/시간입니다.
- updated_at¶
(날짜/시간)
주석이 업데이트된 날짜/시간입니다.
- resolved_at¶
(날짜/시간)
주석이 해결된 날짜/시간(있는 경우)입니다.
- resolved_by¶
(사용자 모델에 대한 외래 키)
이 주석을 해결한 사용자(있는 경우)에 대한 외래 키입니다.
CommentReply¶
주석 스레드에 대한 답글을 나타냅니다.
데이터베이스 필드¶
PageSubscription¶
페이지 이벤트에 대한 이메일 알림 구독을 나타냅니다. 현재 주석 알림에만 사용됩니다.