Database helpers

class vng_api_common.descriptors.GegevensGroepType(mapping: Dict[str, django.db.models.fields.Field], optional: Optional[tuple] = None, required=None, none_for_empty=False)

Structure a body of data from flat model fields.

All keys are always truthy for a value.

Parameters
  • mapping – dict, mapping simple keys to model fields

  • optional – iterable of fields that are NOT required.

  • none_for_empty – convert ‘empty’ values to None, such as empty strings. Booleans are left untouched

class vng_api_common.models.APICredential(*args, **kwargs)

Store credentials for external APIs.

When we need to authenticate against a remote API, we need to know which client ID and secret to use to sign the JWT.

exception DoesNotExist
exception MultipleObjectsReturned
class vng_api_common.models.APIMixin

Determine the absolute URL of a resource in the API.

Model mixin that reverses the URL-path in the API based on the uuid-field of a model instance.

get_absolute_api_url(request=None, **kwargs) str

Build the absolute URL of the object in the API.

class vng_api_common.models.JWTSecret(*args, **kwargs)

Store credentials of clients that want to access our API.

Only clients that are known can access the API (if so configured).

exception DoesNotExist
exception MultipleObjectsReturned