In order to render the `org`, `net`, `fac` and `ix` views a single template is used.
That template exists at `templates/site/view.html`
Properties are passed through to this templates from their respective views in `views.py`
-`views.py::view_network`
-`views.py::view_facility`
-`views.py::view_exchange`
-`views.py::view_organization`
### Data is built by using the REST api serializers
We use the REST API data serialization to build the data piped into those entity views.
```py
data = InternetExchangeSerializer(exchange, context={"user": request.user}).data
```
This allows us to make use of the permissioning of sensitive data according to the user's viewing permissions that already exists within the REST API functionality.
Data is passed through to the template in field definitions using a `dict` for each field.
These field definitions get turned into UI elements that provide both a normal view rendering of the property as well as an `edit-mode` form field.
On the frontend, this UX behavior is handled by the [20c-edit](https://github.com/20c/js-edit) library.
### Entity field definitions
Each field definition has the following common properties:
-`name` (`str`): the name of the field as it exists in the REST API (*required*)
-`label` (`str`): the label of the field as it is shown in the UX (*required, i18n*)
-`value` (`mixed`): the value (*required*)
-`type` (`str`): field type - defaults to `string` - reference to possible values below
-`readonly` (`bool`): if `True` property is not editable
-`help_text` (`str`): tooltip text
-`admin` (`bool`): only visible to object administrators
Some types have specific properties, find those listed below:
### Field types
-`string` (default)
-`number`
-`flags`: renders checkboxes for boolean flags
-`value` (`list<dict>`): one entry for each checkbox (flag), each item should
be a `dict` containing `name` and `value` keys (*required*)
Because the REST API serializers are used to build the field definitions and values sent to the views, some fields may be omitted due to missing permissions.
To avoid this issue, the value passed should always provide a reference to `dismiss` as a default:
```py
"value": data.get("country", dismiss),
```
The `dismiss` object will hide the field if it was not provided in the data.
#### Manual permissioning of fields
In instances where you want to check permissions after the data has been serialized, you can do so using the `DoNotRender` object: