parent
							
								
									44dbee0008
								
							
						
					
					
						commit
						71f88f7218
					
				@ -9,3 +9,4 @@ from .object import *
 | 
			
		||||
from .deadline import *
 | 
			
		||||
from .document import *
 | 
			
		||||
from .geometry import *
 | 
			
		||||
from .parcel import *
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,6 @@ Created on: 15.11.21
 | 
			
		||||
"""
 | 
			
		||||
from django.contrib.gis.db.models import MultiPolygonField
 | 
			
		||||
from django.db import models
 | 
			
		||||
from django.db.models import Q
 | 
			
		||||
 | 
			
		||||
from konova.models import BaseResource, UuidModel
 | 
			
		||||
 | 
			
		||||
@ -69,7 +68,6 @@ class Geometry(BaseResource):
 | 
			
		||||
        resolved_conflicts = all_conflicted_by_conflicts.exclude(id__in=still_conflicting_conflicts)
 | 
			
		||||
        resolved_conflicts.delete()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def get_data_objects(self):
 | 
			
		||||
        """ Getter for all objects which are related to this geometry
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										70
									
								
								konova/models/parcel.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								konova/models/parcel.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,70 @@
 | 
			
		||||
"""
 | 
			
		||||
Author: Michel Peltriaux
 | 
			
		||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
 | 
			
		||||
Contact: michel.peltriaux@sgdnord.rlp.de
 | 
			
		||||
Created on: 16.12.21
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
from django.db import models
 | 
			
		||||
 | 
			
		||||
from konova.models import UuidModel
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Parcel(UuidModel):
 | 
			
		||||
    """ The Parcel model holds administrative data on the covered properties.
 | 
			
		||||
 | 
			
		||||
    Due to the unique but relevant naming of the administrative data, we have to use these namings as field
 | 
			
		||||
    names in german. Any try to translate them to English result in strange or insufficient translations.
 | 
			
		||||
 | 
			
		||||
    All fields have to be CharFields as well, since there are e.g. Flurstücksnummer holding e.g. '123____' which
 | 
			
		||||
    can not be realized using numerical fields.
 | 
			
		||||
 | 
			
		||||
    To avoid conflicts due to german Umlaute, the field names are shortened and vocals are dropped.
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    geometries = models.ManyToManyField("konova.Geometry", related_name="parcels", null=True, blank=True)
 | 
			
		||||
    district = models.ForeignKey("konova.District", on_delete=models.SET_NULL, null=True, blank=True, related_name="parcels")
 | 
			
		||||
    flrstck_nnr = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Flurstücksnenner"
 | 
			
		||||
    )
 | 
			
		||||
    flrstck_zhlr = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Flurstückszähler"
 | 
			
		||||
    )
 | 
			
		||||
    flr = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Flur"
 | 
			
		||||
    )
 | 
			
		||||
    gmrkng = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Gemarkung"
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return f"{self.gmrkng} | {self.flr} | {self.flrstck_nnr} | {self.flrstck_zhlr}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class District(UuidModel):
 | 
			
		||||
    """ The model District holds more coarse information, such as Kreis, Verbandsgemeinde and Gemeinde.
 | 
			
		||||
 | 
			
		||||
    There might be the case that a geometry lies on a hundred Parcel entries but only on one District entry.
 | 
			
		||||
    Therefore a geometry can have a lot of relations to Parcel entries but only a few or only a single one to one
 | 
			
		||||
    District.
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    gmnd = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Gemeinde"
 | 
			
		||||
    )
 | 
			
		||||
    vg = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Verbandsgemeinde",
 | 
			
		||||
    )
 | 
			
		||||
    krs = models.CharField(
 | 
			
		||||
        max_length=1000,
 | 
			
		||||
        help_text="Kreis"
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return f"{self.krs} | {self.vg} | {self.gmnd}"
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user