Skip to content
Snippets Groups Projects
Commit 8ccd0eb1 authored by James Graham's avatar James Graham
Browse files

Add documentation to User, Application and DataSource classes

parent 520d8f1f
Branches
No related tags found
No related merge requests found
...@@ -3,17 +3,30 @@ from django.db import models ...@@ -3,17 +3,30 @@ from django.db import models
from django.urls import reverse from django.urls import reverse
#: Length of CharFields used to hold the names of objects
MAX_LENGTH_NAME = 63 MAX_LENGTH_NAME = 63
class Application(models.Model): class Application(models.Model):
"""
Manage the state of and access to an external application.
An external application may be e.g.:
* A data / metadata visualisation tool
* A data / metadata analysis pipeline
"""
#: Friendly name of this application
name = models.CharField(max_length=MAX_LENGTH_NAME, name = models.CharField(max_length=MAX_LENGTH_NAME,
blank=False, null=False) blank=False, null=False)
#: A brief description
description = models.TextField(blank=True, null=False) description = models.TextField(blank=True, null=False)
#: Address at which the API may be accessed
url = models.URLField(blank=False, null=False) url = models.URLField(blank=False, null=False)
#: User who has responsibility for this application
owner = models.ForeignKey(settings.AUTH_USER_MODEL, owner = models.ForeignKey(settings.AUTH_USER_MODEL,
limit_choices_to={ limit_choices_to={
'groups__name': 'Application providers' 'groups__name': 'Application providers'
......
...@@ -3,17 +3,32 @@ from django.db import models ...@@ -3,17 +3,32 @@ from django.db import models
from django.urls import reverse from django.urls import reverse
#: Length of CharFields used to hold the names of objects
MAX_LENGTH_NAME = 63 MAX_LENGTH_NAME = 63
class DataSource(models.Model): class DataSource(models.Model):
"""
Manage access to a data source API.
Will provide functionality to:
* Query data (with query params)
* Query metadata (with query params)
* Track provenance of the data source itself
* Track provenance of data accesses
"""
#: Friendly name of this data source
name = models.CharField(max_length=MAX_LENGTH_NAME, name = models.CharField(max_length=MAX_LENGTH_NAME,
blank=False, null=False) blank=False, null=False)
#: A brief description
description = models.TextField(blank=True, null=False) description = models.TextField(blank=True, null=False)
#: Address at which the API may be accessed
url = models.URLField(blank=False, null=False) url = models.URLField(blank=False, null=False)
#: User who has responsibility for this data source
owner = models.ForeignKey(settings.AUTH_USER_MODEL, owner = models.ForeignKey(settings.AUTH_USER_MODEL,
limit_choices_to={ limit_choices_to={
'groups__name': 'Data providers' 'groups__name': 'Data providers'
......
...@@ -2,4 +2,8 @@ from django.contrib.auth.models import AbstractUser ...@@ -2,4 +2,8 @@ from django.contrib.auth.models import AbstractUser
class User(AbstractUser): class User(AbstractUser):
"""
Custom Django user model to allow for additional functionality to be
added more easily in the future.
"""
pass pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment