from django.db import models
class Items(models.Model):
Item_Text = models.CharField("Temat", max_length=100)
def __str__(self):
return self.Item_Text
class Meta:
verbose_name = "Temat zgłoszenia"
verbose_name_plural = "Temat zgłoszeń"
class DocumentType(models.Model):
Document_Text = models.CharField("Rodzaj", max_length=100)
def __str__(self):
return self.Document_Text
class Meta:
verbose_name = "Rodzaj zgłoszenia"
verbose_name_plural = "Rodzaj zgłoszeń"
class Status(models.Model):
Status_Text = models.CharField("Status", max_length=100)
def __str__(self):
return self.Status_Text
class Meta:
verbose_name = "Status zgłoszenia"
verbose_name_plural = "Status zgłoszeń"
class BuildingOwner(models.Model):
BuildingOwner_Text = models.CharField("Właściciel", max_length=100)
def __str__(self):
return self.BuildingOwner_Text
class Meta:
verbose_name = "Właściciela budynku"
verbose_name_plural = "Właściciel budynków"
class Building(models.Model):
BuildingOwner = models.ForeignKey(BuildingOwner, verbose_name="Właściciel budynku", on_delete=models.CASCADE)
Building_Text = models.CharField("Budynek", max_length=150)
def __str__(self):
return self.Building_Text
class Meta:
verbose_name = "Budynek"
verbose_name_plural = "Budynki"
class FormFault(models.Model):
Person = models.CharField("Imię i Nazwisko",max_length=300)
Email = models.EmailField("E-mail", max_length=50)
Items = models.ForeignKey(Items, verbose_name="Temat", on_delete=models.CASCADE)
DocumentType = models.ForeignKey(DocumentType, verbose_name="Rodzaj dokumentu", on_delete=models.CASCADE)
Status = models.ForeignKey(Status, on_delete=models.CASCADE)
BuildingOwner = models.ForeignKey(BuildingOwner, verbose_name="Właściciel budynku", on_delete=models.CASCADE)
Building = models.ForeignKey(Building, verbose_name="Budynek", on_delete=models.CASCADE)
Place = models.CharField("Lokal", max_length=10)
class Meta:
verbose_name = "Zgłoszenie"
verbose_name_plural = "Zgłoszenia"