SHARE
TWEET

Untitled

a guest Jan 12th, 2017 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from django.db import models
  2. from django.contrib.postgres.fields import ArrayField
  3.  
  4. # Model for user widgets
  5. from farm.models import *
  6.  
  7. """
  8. Cadastral parcel has informations about grounds cadastral parcel
  9. """
  10. class CadastralParcel(models.Model):
  11.     grounds = models.ForeignKey(Ground,verbose_name=('Applicant'))
  12.     precinct_plot_nr = models.TextField(default="", verbose_name=('precinct_plot'))
  13.     sheet_map_nr = models.IntegerField(default=0, verbose_name=('sheet_map'))
  14.     plot_nr = models.IntegerField(default=0, verbose_name=('plot'))
  15.     hectare_quality = models.FloatField(default=0, verbose_name=('hectare_quality'))
  16.     arable_land = models.FloatField(default=0, verbose_name=('arable_land'))
  17.     arable_land_unreported = models.FloatField(default=0, verbose_name=('arable_land_unreported'))
  18.     preeco_element = models.BooleanField(default=False, verbose_name=('preeco_element'))
  19.  
  20.     class Meta:
  21.         verbose_name=('Cadastral parcel')
  22.         verbose_name_plural=('Cadastral_parcel')
  23.         db_table='document_cadastral_parcel'
  24.  
  25. """
  26. Cadastral_info has information about Agricultural land
  27. """
  28. class CadastralInfo(models.Model):
  29.     cadastral_parcel = models.ForeignKey(CadastralParcel,verbose_name=('cadastral_parcel'))
  30.     agricultural_area_hectar = models.FloatField(default=0, verbose_name=('agricultural_area_hectar'))
  31.  
  32.     class Meta:
  33.         verbose_name=('Cadastral info')
  34.         verbose_name_plural=('Cadastral_info')
  35.         db_table='document_cadastral_info'
  36.  
  37.  
  38. """
  39. Aplicantion save last choosen option
  40. """
  41. class ApplicationOptions(models.Model):
  42.     target = ArrayField(models.TextField())
  43.     statement = ArrayField(models.TextField())
  44.     options = ArrayField(models.TextField())
  45.     system_farm = ArrayField(models.TextField())
  46.  
  47.     class Meta:
  48.         verbose_name=('Application options')
  49.         verbose_name_plural=('Application_options')
  50.         db_table='document_application_options'
  51.  
  52.  
  53. """
  54. Aplicant save last configuration worker
  55. """
  56. class ApplicantData(models.Model):
  57.     identity_number = models.TextField(default="",verbose_name=('identity_number'))
  58.     firstname = models.TextField(default="",verbose_name=('firstname'))
  59.     secondname = models.TextField(default="",verbose_name=('secondname'))
  60.     lastname = models.TextField(default="",verbose_name=('lastname'))
  61.     pesel = models.TextField(default="",verbose_name=('pesel'))
  62.     regon = models.TextField(default="",verbose_name=('regon'))
  63.     number_passport = models.TextField(default="",verbose_name=('passport'))
  64.     country_code = models.TextField(default="",verbose_name=('country_code'))
  65.     phone = models.TextField(default="",verbose_name=('phone'))
  66.     email = models.TextField(default="",verbose_name=('email'))
  67.     bank_account = models.TextField(default="",verbose_name=('bank_account'))
  68.     bank_name = models.TextField(default="",verbose_name=('bank_name'))
  69.     bill_owner = models.TextField(default="",verbose_name=('bill_owner'))
  70.  
  71.     class Meta:
  72.         verbose_name=('Applicant data')
  73.         verbose_name_plural=('Applicant_data')
  74.         db_table='document_applicant_data'
  75.  
  76. """
  77. Defined list of group crops
  78. """
  79. class GroupCrops(models.Model):
  80.     name = models.TextField(default="", verbose_name=('name'))
  81.  
  82.     class Meta:
  83.         verbose_name=('Group crops')
  84.         verbose_name_plural=('Group_crops')
  85.         db_table='document_group_crops'
  86.  
  87. """
  88. Defined list of area
  89. """
  90. class Area(models.Model):
  91.     name = models.TextField(default="", verbose_name=('name'))
  92.  
  93.     class Meta:
  94.         verbose_name=('Area')
  95.         verbose_name_plural=('Area')
  96.         db_table='document_area'
  97.  
  98. """
  99. Defined list of plant
  100. """
  101. class Plant(models.Model):
  102.     name = models.TextField(default="", verbose_name=('name'))
  103.  
  104.     class Meta:
  105.         verbose_name=('Plant')
  106.         verbose_name_plural=('Plant')
  107.         db_table='document_plant'
  108.  
  109. """
  110. The_parcel has information about Agricultural land
  111. """
  112. class TheParcel(models.Model):
  113.     the_parcel_sign =  models.TextField(default="", verbose_name=('the_parcel_sign'))
  114.     group_crops = models.ForeignKey(GroupCrops,verbose_name=('group_crops'))
  115.     area = models.ForeignKey(Area,verbose_name=('area'))
  116.     plant = models.ForeignKey(Plant,verbose_name=('plant'))
  117.     cadastral_parcel = models.ManyToManyField(CadastralInfo)
  118.     surface_plot =  models.FloatField(default=0, verbose_name=('surface_plot'))
  119.  
  120.     class Meta:
  121.         verbose_name=('The parcel')
  122.         verbose_name_plural=('The_parcel')
  123.         db_table='document_the_parcel'
  124.  
  125. """
  126. Document has all information about applicant and his options
  127. """
  128. class Document(models.Model):
  129.     farm = models.ForeignKey(Farm, null=True, verbose_name=('Farm'))
  130.     applicant_data = models.ForeignKey(ApplicantData,verbose_name=('Applicant'))
  131.     application_options = models.ForeignKey(ApplicationOptions,verbose_name=('Options'))
  132.     cadastral_parcel = models.ManyToManyField(CadastralParcel)
  133.     create_data = models.DateTimeField(default=timezone.now,verbose_name=('create_data'))
  134.     campaing_year = models.DateField(verbose_name=('campaing_year'),null=False,default=timezone.now)
  135.     The_parcel = models.ManyToManyField(TheParcel)
  136.  
  137.     class Meta:
  138.         verbose_name=('Document')
  139.         verbose_name_plural=('Document')
  140.         db_table='document_document'
RAW Paste Data
Top