Skip to content

Instantly share code, notes, and snippets.

@Glukhoff
Created June 28, 2022 06:09
Show Gist options
  • Save Glukhoff/242a6a8ef851c02254a205a88932a870 to your computer and use it in GitHub Desktop.
Save Glukhoff/242a6a8ef851c02254a205a88932a870 to your computer and use it in GitHub Desktop.
class OwnersDetails(models.Model):
first_name = models.CharField(verbose_name="Фамилия", max_length=50, blank=True)
last_name = models.CharField(verbose_name="Имя", max_length=50, blank=True)
name_organization = models.CharField(verbose_name="Наименование организации", max_length=150, blank=True)
inn_organization = models.BigIntegerField(verbose_name="ИНН организации", blank=True)
person_number_phone = models.BigIntegerField(verbose_name="Номер телефона", blank=True)
city = models.CharField(verbose_name="Город", max_length=100, blank=True)
street = models.CharField(verbose_name="Улица", max_length=100, blank=True)
house_number = models.CharField(verbose_name="Номер дома / офиса", max_length=50, blank=True)
def __str__(self):
return self.name_organization
class Meta:
verbose_name = "данные заказчика"
verbose_name_plural = "данные заказчиков"
indexes = [
models.Index(fields=["inn_organization"]),
models.Index(fields=["name_organization"])
]
class Device(models.Model):
owners_details = models.ForeignKey(
OwnersDetails,
models.SET_NULL,
related_name='owners_details_device',
blank=True,
null=True
)
imai = models.CharField(verbose_name="IMEI", max_length=20)
serial_number = models.CharField(verbose_name="Серийный номер", max_length=20)
def __str__(self):
return self.serial_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment