7.1.4.1. Webwhois Django Templates¶
This section explains the basics of Django templates and gives a reference of the contexts that are passed to the webwhois templates by default.
You can find the templates in webwhois/templates
of the fred-webwhois app.
Templating basics
A resulting site is rendered from a template and a context. A context is a dictionary of keys and values that are passed to a template from a view. Context values can be accessed in templates by using context keys as variable names.
The basic components of the Django template system allow you to:
Output a value of a variable
My first name is {{ first_name }}.
Control the flow
{% if user.is_authenticated %}Hello, {{ user.username }}.{% endif %}
Define (or override) a block
{% block main_content %} <p>Some main content here.</p> {% endblock %}
Include a partial template
{% include "webwhois/include/public_request_form_fields.html" with pubreq_selected_menu="personal_info" %}
Extend a template
{% extends template_name %} {# Here you can override some blocks. And this is a line comment. #}
And more.
See Django 1.11: Template language reference.
Basic context
The reference below mentions only template context that is added by specific webwhois class-based views.
The template context contains also items that are generated by the super classes, from which the webwhois views inherit, such as generic views and context mixins.
The template context of all class-based generic views include a view
variable
that points to the View
instance. This allows you to access attributes
of the view in the template, such as view.attribute_name
.
For information on context inherited from Django class-based views, see Django 1.11: Built-in class-based views API reference.
7.1.4.1.1. Base template¶
The default base-template name is base_site_example.html
,
but changing it is complicated, therefore we recommend to use the default name.
7.1.4.1.2. Server exceptions template¶
The template used to render errors.
Template name: webwhois/server_exception.html
Default additional context (see also basic context):
handle
– The handle, which a user has entered in the search form.managed_zone_list
– A list of zones managed by the Registry. (Available only with theserver_exception.unmanaged_zone
error.)Changed in version NEXT: This variable is deprecated, use
managed_zones
context processor instead.server_exception
– An error object. It has the following attributes:code
– A code of the error, e.g.OBJECT_NOT_FOUND
,UNMANAGED_ZONE
,INVALID_HANDLE
etc.title
– A title of the error.message
– An error message. .. versionchanged:: NEXTThe message may be
None
.
And may have following keys:
Changed in version NEXT: Following keys are deprecated. Use
code
and/orview.object_type_name
instead.handle_is_in_zone
–True
if the user-provided handle is recognized as a valid domain name but does not match any record.too_many_parts_in_domain_name
–True
if the user-provided handle is recognized as a domain name but has more parts than are managed by the Registry.unmanaged_zone
–True
if the user-provided handle is recognized as a domain name but is not in any zone managed by the Registry (wrong TLD).object_not_found
–True
if the user-provided handle was not found in the Registry.
This template is rendered by RegistryObjectMixin
.
7.1.4.1.3. Templates for whois lookup¶
This section covers a set of templates for whois lookup and results.
7.1.4.1.3.1. Search form template¶
Template name: webwhois/form_whois.html
Default additional context (see also basic context): None additional.
This template is rendered by WhoisFormView
.
7.1.4.1.3.2. Multiple-entries result template¶
Template name: webwhois/multiple_entries.html
Default additional context (see also basic context):
handle
– The handle, which a user has entered in the search form.registry_objects.contact.*
– Same structure as in Contact details template.registry_objects.domain.*
– Same structure as in Domain details template.registry_objects.nsset.*
– Same structure as in Nsset details template.registry_objects.keyset.*
– Same structure as in Keyset details template.registry_objects.registrar.*
– Same structure as in Registrar details template.
This template is rendered by ResolveHandleTypeView
.
7.1.4.1.3.3. Contact details template¶
Template name: webwhois/contact.html
Default additional context (see also basic context):
handle
– A contact handle.registry_objects.contact.detail
– A CORBA object with contact data, seeContact
structure in Whois2.idl.registry_objects.contact.birth_date
– A contact birth date.registry_objects.contact.status_descriptions
– List of contact status labels. Verification statuses are excluded.registry_objects.contact.verification_status
– List of verification statuses. Each member has the following keys:code
– Status codelabel
– Status labelicon
– Path to a status icon
registry_objects.contact.is_linked
– Whether a contact is linked to another object in the Registry.registry_objects.contact.creating_registrar
– The creating registrar – a CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.registry_objects.contact.sponsoring_registrar
– The current sponsoring registrar – a CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.object_delete_candidate
– Whether the contact is in delete candidate status.
This template is rendered by ContactDetailView
.
7.1.4.1.3.4. Domain details template¶
Template name: webwhois/domain.html
Default additional context (see also basic context):
handle
– A domain handle.registry_objects.domain.detail
– A CORBA object with domain data, seeDomain
structure in Whois2.idl. If the domain has delete candidate status, it isNone
.registry_objects.domain.status_descriptions
– List of domain status labels.registry_objects.domain.registrant
– The domain holder – CORBA object with contact data, seeContact
structure in Whois2.idl.registry_objects.domain.registrar
– The current sponsoring registrar – a CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.registry_objects.domain.admins
– List of domain’s administrative contacts. Each member is a CORBA object with contact data, seeContact
structure in Whois2.idl.registry_objects.domain.nsset
– Domain’s nsset – a CORBA object with nsset data, seeNSSet
structure in Whois2.idl.registry_objects.domain.keyset
– Domain’s keyset – a CORBA object with keyset data, seeKeySet
structure in Whois2.idl.object_delete_candidate
– Whether the domain is in delete candidate status.DNSSEC_URL
– Value ofWEBWHOIS_DNSSEC_URL
setting.
This template is rendered by DomainDetailView
.
7.1.4.1.3.5. Nsset details template¶
Template name: webwhois/nsset.html
+ includes webwhois/nsset_detail.html
Default additional context (see also basic context):
handle
– A nsset handle.registry_objects.nsset.detail
– A CORBA object with nsset data, seeNSSet
structure in Whois2.idl.registry_objects.nsset.status_descriptions
– List of nsset status labels.registry_objects.nsset.registrar
– The sponsoring registrar – a CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.registry_objects.nsset.admins
– List of technical contacts. Each member is a CORBA object with contact data, seeContact
structure in Whois2.idl.object_delete_candidate
– Whether the nsset is in delete candidate status.
This template is rendered by NssetDetailView
.
7.1.4.1.3.6. Keyset details template¶
Template name: webwhois/keyset.html
+ includes webwhois/keyset_detail.html
Default additional context (see also basic context):
handle
– A keyset handle.registry_objects.keyset.detail
– A CORBA object with keyset data, seeKeySet
structure in Whois2.idl.registry_objects.keyset.status_descriptions
– List of keyset status labels.registry_objects.keyset.registrar
– The sponsoring registrar – a CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.registry_objects.keyset.admins
– List of technical contacts. Each member is a CORBA object with contact data, seeContact
structure in Whois2.idl.object_delete_candidate
– Whether the keyset is in delete candidate status.
This template is rendered by KeysetDetailView
.
7.1.4.1.4. Templates for registrar listing¶
This section covers a set of templates for registrar listing.
7.1.4.1.4.1. A list of registrars template¶
Template name: webwhois/registrar_list.html
Default additional context (see also basic context):
groups
– Mapping of all registrar groups.registrars
– List of registrar context objects. Each object has following keys:registrar
– A CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.cert
– Certification object.score
– Certification score.stars
– Range of certification score.
is_retail
– Denotes whether a list of registrars was filtered to retail or wholesale registrars:None
if not using the retail/wholesale filtering,True
if only retail registrars are displayed,False
if only wholesale registrars are displayed.
Deprecated since version 1.15: Will be removed in 1.16. Use
group_name
instead.
This template is rendered by RegistrarListView
.
7.1.4.1.4.2. Registrar details template¶
Template name: webwhois/registrar.html
Default additional context (see also basic context):
registry_objects.registrar.detail
– A CORBA object with registrar data, seeRegistrar
structure in Whois2.idl.
This template is rendered by RegistrarDetailView
.
7.1.4.1.5. Templates for public requests¶
This section covers a set of templates for submission of public requests and according responses.
7.1.4.1.5.2. Request forms – Send personal information template¶
Template name: webwhois/form_personal_info.html
+ includes webwhois/include/public_request_form_fields.html
Default additional context (see also basic context): None additional.
This template is rendered by PersonalInfoFormView
.
7.1.4.1.5.3. Request forms – Lock an object template¶
Template name: webwhois/form_block_object.html
+ includes webwhois/include/public_request_form_fields.html
Default additional context (see also basic context): None additional.
This template is rendered by BlockObjectFormView
.
7.1.4.1.5.4. Request forms – Unlock an object template¶
Template name: webwhois/form_unblock_object.html
+ includes webwhois/include/public_request_form_fields.html
Default additional context (see also basic context): None additional.
This template is rendered by UnblockObjectFormView
.
7.1.4.1.5.5. Responses – Unknown public response template¶
Returned when a link to a public request is no longer valid (e.g. an outdated request).
Template name: webwhois/public_request_response_not_found.html
Default additional context (see also basic context): None additional.
This template is rendered by PublicResponseNotFoundView
.
7.1.4.1.5.6. Public response data¶
Default additional context common to the following templates:
public_response
– A public response object.object_type
– A type of the registrable object in question.public_request_id
– An identifier of the public request.handle
– The handle of the registrable object.request_type
- A type of the public request.confirmation_method
- Confirmation method used.create_date
- Public request create date.
This template is rendered by BaseResponseTemplateView
.
7.1.4.1.5.7. Responses – Public response with an answer sent to an email in the Registry template¶
Template name: webwhois/public_request_email_in_registry.html
Default additional context (see also basic context):
public_response
– A public response object.text_title
– A page title.text_header
– A page header.text_content
– A page content.
This template is rendered by EmailInRegistryView
.
7.1.4.1.5.8. Responses – Public response with an answer sent to a custom email template¶
Template name: webwhois/public_request_custom_email.html
Default additional context (see also basic context):
public_response
– A public response object.text_title
– A page title.text_header
– A page header.text_subject
– The email subject.text_content
– The email body content.
This template is rendered by CustomEmailView
.
7.1.4.1.5.9. Responses – Public response confirmed with a notarized letter template¶
Template name: webwhois/public_request_notarized_letter.html
Default additional context (see also basic context):
public_response
– A public response object.text_title
– A page title.notarized_letter_pdf_url
– The URL of the PDF file with the notarized letter.pdf_name
– The name of the PDF file.
This template is rendered by NotarizedLetterView
.