71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
"""
|
|
Author: Michel Peltriaux
|
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
Created on: 17.11.20
|
|
|
|
"""
|
|
import uuid
|
|
|
|
from django.contrib.auth.models import User
|
|
from django.contrib.gis.db.models import MultiPolygonField
|
|
from django.db import models
|
|
|
|
|
|
class BaseResource(models.Model):
|
|
"""
|
|
A basic resource model, which defines attributes for every derived model
|
|
"""
|
|
id = models.UUIDField(
|
|
primary_key=True,
|
|
default=uuid.uuid4,
|
|
)
|
|
created_on = models.DateTimeField(auto_now_add=True, null=True)
|
|
created_by = models.ForeignKey(User, null=True, on_delete=models.SET_NULL, related_name="+")
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
|
|
class BaseObject(BaseResource):
|
|
"""
|
|
A basic object model, which specifies BaseResource.
|
|
|
|
Mainly used for intervention, compensation, ecoaccount
|
|
"""
|
|
identifier = models.CharField(max_length=1000, null=True, blank=True)
|
|
title = models.CharField(max_length=1000, null=True, blank=True)
|
|
deleted_on = models.DateTimeField(null=True)
|
|
deleted_by = models.ForeignKey(User, null=True, on_delete=models.SET_NULL, related_name="+")
|
|
comment = models.TextField()
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
|
|
class Deadline(BaseResource):
|
|
"""
|
|
Defines a deadline, which can be used to define dates with a semantic meaning
|
|
"""
|
|
type = models.CharField(max_length=500, null=True, blank=True)
|
|
date = models.DateField(null=True, blank=True)
|
|
|
|
def __str__(self):
|
|
return self.type
|
|
|
|
|
|
class Document(BaseResource):
|
|
"""
|
|
Documents can be attached to compensation or intervention for uploading legal documents or pictures.
|
|
"""
|
|
date_of_creation = models.DateField()
|
|
document = models.FileField()
|
|
comment = models.TextField()
|
|
|
|
|
|
class Geometry(BaseResource):
|
|
"""
|
|
Outsourced geometry model so multiple versions of the same object can refer to the same geometry if it is not changed
|
|
"""
|
|
geom = MultiPolygonField(null=True, blank=True)
|