Refactoring to konova

This commit is contained in:
mipel
2021-07-01 14:38:57 +02:00
parent a5e8bcfa8c
commit 4084373e2b
60 changed files with 103 additions and 17901 deletions
+70
View File
@@ -0,0 +1,70 @@
"""
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)
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)
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 process, 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)