class Project(models.Model):
title = models.CharField('Имя', max_length=200)
contract_number = models.CharField('Номер договора', max_length=200)
description = models.TextField()
create_date = models.DateTimeField("date published",
auto_now_add=True)
author = models.ForeignKey(User, on_delete=models.PROTECT,
related_name="projects")
customer = models.ForeignKey('Customer',
on_delete=models.PROTECT,
related_name="projects")
price = models.FloatField('Стоимость проекта')
additional_pay = models.FloatField('Дополнительная оплата', blank=True,
null=True)
total_pay = price + additional_pay
class Meta:
ordering = ["-pk"]
def __str__(self):
return self.title[:15]