1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/docs/dev/modules/views.py.md

311 lines
5.7 KiB
Markdown
Raw Normal View History

Generated from views.py on 2022-04-12 16:41:02.631987
# peeringdb_server.views
View definitions:
- Login
- Logout
- Advanced search
- User Profile
- OAuth Profile
- Landing page
- Search results
- Entity views (network, facility, internet exchange and organization)
- Sponsorships
- User Registration
# Functions
---
## beta_sync_dt
`def beta_sync_dt()`
Return the next date for a beta sync.
This is currently hard coded to return 00:00Z for the
next Sunday.
---
## cancel_affiliation_request
Support 202111 (#1101) * Block registering private ASN ranges * Add a continental region field for facilities #1007 * Incorrect order of search results #232 * Allow users to upload a small logo to their record #346 * Sponsor badge CSS and text translation issues #453 * IXP and Facility summary #18 * Add sales email and phone contact to ix object #949 * Increase timeout timer for IX-F JSON importer to 30s #962 * IX-F manually triggered import bugs #1054 * remove survey notifications * IX-F importer: manual add followed by IX-F prompted add can result in "The server rejected your data" #807 * performance fix for net view * api documentation generate broken #956 * fix poc set missing from net view * Auto focus cursor on search field on main website #695 * PeeringDB website has a poor choice of line-breaks for IPv6 addresses. #748 * Delete childless org objects #838 * linting * poetry lock * re-add mistakingly dropped translation to email template * fix template variables * regen docs * regen api docs * add u2f api * fix merge cruft * fido u2f webauthn first steps * dont need this * typo * first ux steps for security key management, u2f views * u2f auth * linting * Cascade delete when performed by superuser in django-admin #735 * security key passwordless login * reset webauthn migrations * security key 2fa * linting * ux cleanup * cleanup * Add IXP to AS record / dropdown limited #469 * ignore orgs that have pre-dated or finished sponsorships attached * split out to django_security_keys * default to 90 days * make URL required for new objects #374 * move CONN_MAX_AGE to proper location and expose as env var (#1060) * Error message for invalid password on email change * Registering a new facility or exchange organization is broken #1062 * Creating a facility that matches the name of a soft-deleted facility will cause the entry to bypass the verification queue #901 * irr source validator doesn't allow for hyphens in source #921 * split out javascript * split out js * Clicking "Add" to add a user api-key without providing a name for the key raises Internal Error #1033 * remove security key admin views * global stats don't show up at login screen #284 * Possible for "pending" exchange to have "deleted" ixlan (#1077) * webauthn finalizations * oidc support for oauth provider #1070 * Revert "Merge branch 'gh_1070' into 'support_202111'" * remove unused dev mounts * linting * add django-security-key and relock poetry * re-add imports removed through linting * docs regen * oauth toolkit pinned to 1.6.1 django-security-keys pinned to 1.0.1 * remove debug message * linting * linting Co-authored-by: Stefan Pratter <stefan@20c.com> Co-authored-by: David Poarch <dpoarch@20c.com>
2022-01-11 08:56:47 -06:00
`def cancel_affiliation_request(*args, **kwds)`
Cancel a user's affiliation request.
---
## export_permissions
`def export_permissions(user, entity)`
Return dict of permission bools for the specified user and entity
to be used in template context.
---
## field_help
`def field_help(model, field)`
Helper function return help_text of a model
field.
---
## request_api_search
`def request_api_search(request)`
Triggered by typing something in the main peeringdb search bar
without hitting enter (quasi autocomplete).
---
## request_search
`def request_search(request)`
Triggered by hitting enter on the main search bar.
Renders a search result page.
---
## validator_result_cache
`def validator_result_cache(request, cache_id)`
Return CSV data from cache.
---
## view_about
`def view_about(request)`
Render page containing about.
---
## view_advanced_search
`def view_advanced_search(request)`
View for advanced search.
---
## view_affiliate_to_org
`def view_affiliate_to_org(request, *args, **kwargs)`
Allow the user to request affiliation with an organization through
an ASN they provide.
---
## view_aup
`def view_aup(request)`
Render page containing acceptable use policy.
---
## view_close_account
`def view_close_account(request, *args, **kwargs)`
Set user's account inactive, delete email addresses and API keys and logout the session.
---
## view_component
`def view_component(request, component, data, title, perms=None, instance=None, **kwargs)`
Generic component view.
---
## view_exchange
`def view_exchange(request, id)`
View exchange data for exchange specified by id.
---
## view_facility
`def view_facility(request, id)`
View facility data for facility specified by id.
---
## view_index
`def view_index(request, errors=None)`
Landing page view.
---
## view_network
`def view_network(request, id)`
View network data for network specified by id.
---
## view_organization
`def view_organization(request, id)`
View organization data for org specified by id.
---
## view_partnerships
`def view_partnerships(request)`
View current partners.
---
## view_password_reset
`def view_password_reset(request, *args, **kwargs)`
Password reset initiation view.
---
## view_registration
`def view_registration(request, *args, **kwargs)`
User registration page view.
---
## view_request_ownership
Support 202111 (#1101) * Block registering private ASN ranges * Add a continental region field for facilities #1007 * Incorrect order of search results #232 * Allow users to upload a small logo to their record #346 * Sponsor badge CSS and text translation issues #453 * IXP and Facility summary #18 * Add sales email and phone contact to ix object #949 * Increase timeout timer for IX-F JSON importer to 30s #962 * IX-F manually triggered import bugs #1054 * remove survey notifications * IX-F importer: manual add followed by IX-F prompted add can result in "The server rejected your data" #807 * performance fix for net view * api documentation generate broken #956 * fix poc set missing from net view * Auto focus cursor on search field on main website #695 * PeeringDB website has a poor choice of line-breaks for IPv6 addresses. #748 * Delete childless org objects #838 * linting * poetry lock * re-add mistakingly dropped translation to email template * fix template variables * regen docs * regen api docs * add u2f api * fix merge cruft * fido u2f webauthn first steps * dont need this * typo * first ux steps for security key management, u2f views * u2f auth * linting * Cascade delete when performed by superuser in django-admin #735 * security key passwordless login * reset webauthn migrations * security key 2fa * linting * ux cleanup * cleanup * Add IXP to AS record / dropdown limited #469 * ignore orgs that have pre-dated or finished sponsorships attached * split out to django_security_keys * default to 90 days * make URL required for new objects #374 * move CONN_MAX_AGE to proper location and expose as env var (#1060) * Error message for invalid password on email change * Registering a new facility or exchange organization is broken #1062 * Creating a facility that matches the name of a soft-deleted facility will cause the entry to bypass the verification queue #901 * irr source validator doesn't allow for hyphens in source #921 * split out javascript * split out js * Clicking "Add" to add a user api-key without providing a name for the key raises Internal Error #1033 * remove security key admin views * global stats don't show up at login screen #284 * Possible for "pending" exchange to have "deleted" ixlan (#1077) * webauthn finalizations * oidc support for oauth provider #1070 * Revert "Merge branch 'gh_1070' into 'support_202111'" * remove unused dev mounts * linting * add django-security-key and relock poetry * re-add imports removed through linting * docs regen * oauth toolkit pinned to 1.6.1 django-security-keys pinned to 1.0.1 * remove debug message * linting * linting Co-authored-by: Stefan Pratter <stefan@20c.com> Co-authored-by: David Poarch <dpoarch@20c.com>
2022-01-11 08:56:47 -06:00
`def view_request_ownership(*args, **kwds)`
Render the form that allows users to request ownership
to an unclaimed organization.
---
## view_simple_content
`def view_simple_content(request, content_name)`
Render the content in templates/{{ content_name }} inside
the peeringdb layout.
---
## view_sponsorships
`def view_sponsorships(request)`
View current sponsorships.
---
## view_username_retrieve
`def view_username_retrieve(request, *args, **kwargs)`
Username retrieval view.
---
## view_username_retrieve_complete
`def view_username_retrieve_complete(request, *args, **kwargs)`
Username retrieval completion view.
Show the list of usernames associated to an email if
the correct secret is provided.
---
## view_username_retrieve_initiate
`def view_username_retrieve_initiate(request, *args, **kwargs)`
Username retrieval initiate view.
---
# Classes
---
## DoNotRender
```
DoNotRender(builtins.object)
```
Instance of this class is sent when a component attribute does not exist,
this can then be type checked in the templates to remove non existant attribute
rows while still allowing attributes with nonetype values to be rendered.
### Class Methods
#### permissioned
`def permissioned(cls, value, user, namespace, explicit=False)`
Check if the user has permissions to the supplied namespace
returns a DoNotRender instance if not, otherwise returns
the supplied value.
---
## LoginView
```
Support 202111 (#1101) * Block registering private ASN ranges * Add a continental region field for facilities #1007 * Incorrect order of search results #232 * Allow users to upload a small logo to their record #346 * Sponsor badge CSS and text translation issues #453 * IXP and Facility summary #18 * Add sales email and phone contact to ix object #949 * Increase timeout timer for IX-F JSON importer to 30s #962 * IX-F manually triggered import bugs #1054 * remove survey notifications * IX-F importer: manual add followed by IX-F prompted add can result in "The server rejected your data" #807 * performance fix for net view * api documentation generate broken #956 * fix poc set missing from net view * Auto focus cursor on search field on main website #695 * PeeringDB website has a poor choice of line-breaks for IPv6 addresses. #748 * Delete childless org objects #838 * linting * poetry lock * re-add mistakingly dropped translation to email template * fix template variables * regen docs * regen api docs * add u2f api * fix merge cruft * fido u2f webauthn first steps * dont need this * typo * first ux steps for security key management, u2f views * u2f auth * linting * Cascade delete when performed by superuser in django-admin #735 * security key passwordless login * reset webauthn migrations * security key 2fa * linting * ux cleanup * cleanup * Add IXP to AS record / dropdown limited #469 * ignore orgs that have pre-dated or finished sponsorships attached * split out to django_security_keys * default to 90 days * make URL required for new objects #374 * move CONN_MAX_AGE to proper location and expose as env var (#1060) * Error message for invalid password on email change * Registering a new facility or exchange organization is broken #1062 * Creating a facility that matches the name of a soft-deleted facility will cause the entry to bypass the verification queue #901 * irr source validator doesn't allow for hyphens in source #921 * split out javascript * split out js * Clicking "Add" to add a user api-key without providing a name for the key raises Internal Error #1033 * remove security key admin views * global stats don't show up at login screen #284 * Possible for "pending" exchange to have "deleted" ixlan (#1077) * webauthn finalizations * oidc support for oauth provider #1070 * Revert "Merge branch 'gh_1070' into 'support_202111'" * remove unused dev mounts * linting * add django-security-key and relock poetry * re-add imports removed through linting * docs regen * oauth toolkit pinned to 1.6.1 django-security-keys pinned to 1.0.1 * remove debug message * linting * linting Co-authored-by: Stefan Pratter <stefan@20c.com> Co-authored-by: David Poarch <dpoarch@20c.com>
2022-01-11 08:56:47 -06:00
LoginView(django_security_keys.ext.two_factor.views.LoginView)
```
Extend the `LoginView` class provided
by `two_factor` because some
PDB specific functionality and checks need to be added.
### Methods
#### done
`def done(self, form_list, **kwargs)`
User authenticated successfully, set language options.
---
#### get
`def get(self, *args, **kwargs)`
If a user is already authenticated, don't show the
login process, instead redirect to /
---
#### get_context_data
`def get_context_data(self, form, **kwargs)`
If post request was rate limited the rate limit message
needs to be communicated via the template context.
---
#### get_device
`def get_device(self, step=None)`
Override this to can enable EmailDevice as a
challenge device for one time passwords.
---
#### get_email_device
`def get_email_device(self)`
Return an EmailDevice instance for the requesting user
which can be used for one time passwords.
Support 202111 (#1101) * Block registering private ASN ranges * Add a continental region field for facilities #1007 * Incorrect order of search results #232 * Allow users to upload a small logo to their record #346 * Sponsor badge CSS and text translation issues #453 * IXP and Facility summary #18 * Add sales email and phone contact to ix object #949 * Increase timeout timer for IX-F JSON importer to 30s #962 * IX-F manually triggered import bugs #1054 * remove survey notifications * IX-F importer: manual add followed by IX-F prompted add can result in "The server rejected your data" #807 * performance fix for net view * api documentation generate broken #956 * fix poc set missing from net view * Auto focus cursor on search field on main website #695 * PeeringDB website has a poor choice of line-breaks for IPv6 addresses. #748 * Delete childless org objects #838 * linting * poetry lock * re-add mistakingly dropped translation to email template * fix template variables * regen docs * regen api docs * add u2f api * fix merge cruft * fido u2f webauthn first steps * dont need this * typo * first ux steps for security key management, u2f views * u2f auth * linting * Cascade delete when performed by superuser in django-admin #735 * security key passwordless login * reset webauthn migrations * security key 2fa * linting * ux cleanup * cleanup * Add IXP to AS record / dropdown limited #469 * ignore orgs that have pre-dated or finished sponsorships attached * split out to django_security_keys * default to 90 days * make URL required for new objects #374 * move CONN_MAX_AGE to proper location and expose as env var (#1060) * Error message for invalid password on email change * Registering a new facility or exchange organization is broken #1062 * Creating a facility that matches the name of a soft-deleted facility will cause the entry to bypass the verification queue #901 * irr source validator doesn't allow for hyphens in source #921 * split out javascript * split out js * Clicking "Add" to add a user api-key without providing a name for the key raises Internal Error #1033 * remove security key admin views * global stats don't show up at login screen #284 * Possible for "pending" exchange to have "deleted" ixlan (#1077) * webauthn finalizations * oidc support for oauth provider #1070 * Revert "Merge branch 'gh_1070' into 'support_202111'" * remove unused dev mounts * linting * add django-security-key and relock poetry * re-add imports removed through linting * docs regen * oauth toolkit pinned to 1.6.1 django-security-keys pinned to 1.0.1 * remove debug message * linting * linting Co-authored-by: Stefan Pratter <stefan@20c.com> Co-authored-by: David Poarch <dpoarch@20c.com>
2022-01-11 08:56:47 -06:00
---
#### get_form_kwargs
`def get_form_kwargs(self, step=None)`
AuthenticationTokenForm requires the user kwarg.
---
#### get_redirect_url
`def get_redirect_url(self)`
Specify which redirect urls are valid.
---
#### post
`def post(self, *args, **kwargs)`
Posts to the `auth` step of the authentication
process need to be rate limited.
---
## OrganizationLogoUpload
```
OrganizationLogoUpload(django.views.generic.base.View)
```
Handles public upload and setting of organization logo (#346)
### Methods
#### delete
`def delete(self, request, id)`
delete the logo
---
#### post
`def post(self, request, id)`
upload and set a new logo
---