#31 API basic implementation
* adds new app to project * adds relation between User model and new APIUserToken model * adds first implementation for GET of intervention * adds basic code layout for future extension by having new versions
This commit is contained in:
8
api/models/__init__.py
Normal file
8
api/models/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 21.01.22
|
||||
|
||||
"""
|
||||
from .token import *
|
||||
23
api/models/token.py
Normal file
23
api/models/token.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.db import models
|
||||
|
||||
from konova.utils.generators import generate_token
|
||||
|
||||
|
||||
class APIUserToken(models.Model):
|
||||
token = models.CharField(
|
||||
primary_key=True,
|
||||
max_length=1000,
|
||||
default=generate_token,
|
||||
)
|
||||
valid_until = models.DateField(
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="Token is only valid until this date",
|
||||
)
|
||||
is_active = models.BooleanField(
|
||||
default=False,
|
||||
help_text="Must be activated by an admin"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.token
|
||||
Reference in New Issue
Block a user