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.md
Matt Griswold 8ef76dc5ab Support 202110 (#1085)
* 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

* fix merge cruft

* django-peeringdb to 2.11 and poetry relock

* linting

* comment out django-peeringdb volume mount

* add missing declaration

Co-authored-by: Stefan Pratter <stefan@20c.com>
Co-authored-by: David Poarch <dpoarch@20c.com>
2021-11-09 09:47:38 -06:00

7.6 KiB

Generated on 2021-11-02 10:01:21.394759

admin.py

django-admin interface definitions

This is the interface used by peeringdb admin-com that is currently exposed at the path /cp.

New admin views wrapping HandleRef models need to extend the SoftDeleteAdmin class.

Admin views wrapping verification-queue enabled models need to also add the ModelAdminWithVQCtrl Mixin.

Version history is implemented through django-handleref.

admin_commandline_tools.py

Defines CLI wrappers for django commands that should be executable through the django-admin interface.

Extend the CommandLineToolWrapper class and call the register_tool decorator to add support for a new django command to exposed in this manner.

api_cache.py

Handle loading of api-cache data.

api_key_views.py

Views for organization api key management.

api_schema.py

Augment REST API schema to use for open-api schema generation.

open-api schema generation leans heavily on automatic generation implemented through the django-rest-framework.

Specify custom fields to be added to the generated open-api schema.

apps.py

Django apps configuration.

autocomplete_views.py

Autocomplete views.

Handle most autocomplete functionality found in peeringdb.

Note: Quick search behavior is specified in search.py

context.py

Define custom context managers.

data_views.py

This holds JSON views for various data sets.

These are needed for filling form-selects for editable mode in UX.

db_router.py

Custom django database routers.

Split read and write database connections if needed.

deskpro.py

DeskPro API Client used to post and retrieve support ticket information from the deskpro API.

export_views.py

Define export views used for IX-F export and advanced search file download.

forms.py

Custom django forms.

Note: This does not includes forms pointed directly at the REST api to handle updates (such as /net, /ix, /fac or /org endpoints).

Look in rest.py and serializers.py for those.

geo.py

Utilities for geocoding and geo normalization.

import_views.py

Define ix-f import preview, review and post-mortem views.

inet.py

RDAP lookup and validation.

Network validation.

Prefix renumbering.

ixf.py

IX-F importer implementation.

Handles import of ix-f feeds, creation of suggestions for networks and exchanges to follow.

Handles notifications of networks and exchanges as part of that process.

A substantial part of the import logic is handled through models.py::IXFMemberData

mail.py

Utility functions for emailing users and admin staff.

maintenance.py

Django middleware to handle maintenance mode.

middleware.py

Custom django middleware.

mock.py

Handle generation of mock data for testing purposes.

models.py

Django model definitions (database schema).

django-peeringdb

peeringdb_server uses the abstract models from django-peeringdb.

Often, it makes the most sense for a field to be added to the abstraction in django-peeringdb, so it can be available for people using local snapshots of the databases.

Generally speaking, if the field is to be added to the REST API output, it should be added through django-peeringdb.

Fields to facilitate internal operations of peeringdb on the other hand, DO NOT need to be added to django-peeringdb.

migrations

For concrete models, django-peeringdb and peeringdb_server maintain separate model migrations.

When adding new fields to django-peeringdb make sure migration files for the schema changes exist in both places.

Please open a merge request in peeringdb/django-peeringdb for the field addition as well.

org_admin_views.py

View for organization administrative actions (/org endpoint).

permissions.py

Utilities for permission handling.

Permission logic is handled through django-grainy.

API key auth is handled through djangorestframework-api-key.

Determine permission holder from request (api key or user).

Read only user api key handling.

Censor API output data according to permissions using grainy Applicators.

renderers.py

REST API renderer.

Ensure valid json output of the REST API.

request.py

Django HTTPRequest utilities.

rest.py

REST API view definitions.

REST API path routing.

REST API permission checking (facilitated through django-grainy).

REST API error handling.

REST API list filtering logic.

peeringdb-py client compatibility checking.

The peeringdb REST API is implemented through django-rest-framework.

rest_throttles.py

Custom rate limit handlers for the REST API.

search.py

Search implementation used for the peeringdb top search bar, name searches through the api name_search filter, as well as advanced search functionality.

Search logic is handled by django-haystack and whoosh.

Refer to search_indexes.py for search index definition.

search_indexes.py

Defines django-haystack search indexes.

serializers.py

REST API Serializer definitions. REST API POST / PUT data validators.

New serializers should extend ModelSerializer class, which is a custom extension of django-rest-framework's ModelSerializer.

Custom ModelSerializer implements logic for the expansion of relationships driven by the depth url parameter. The depth parameter indicates how many objects to recurse into.

Special api filtering implementation should be done through the prepare_query method.

settings.py

(Being DEPRECATED) django settings preparation.

This is mostly DEPRECATED at this point and any new settings should be directly defined in mainsite/settings.

signals.py

Django signal handlers

  • org usergroup creation
  • entity count updates (fac_count, net_count etc.)
  • geocode when address model (org, fac) is saved
  • verification queue creation on new objects
  • asn rdap automation to automatically grant org / network to user
  • user to org affiliation handling when targeted org has no users
    • notify admin-com
  • CORS enabling for GET api requests

stats.py

Load and maintain global stats (displayed in peeringdb footer).

urls.py

Django url to view routing.

util.py

Assorted utility functions for peeringdb site templates.

validators.py

peeringdb model / field validators

views.py

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