Brak opisu

models.py 701B

1234567891011121314151617181920
  1. from __future__ import annotations
  2. from django.db import models
  3. from orgs.models import Organization
  4. class Lead(models.Model):
  5. organization = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name="leads")
  6. name = models.CharField(max_length=255)
  7. email = models.EmailField(blank=True)
  8. phone = models.CharField(max_length=64, blank=True)
  9. subject = models.CharField(max_length=255, blank=True)
  10. message = models.TextField(blank=True)
  11. source = models.CharField(max_length=64, blank=True)
  12. created_at = models.DateTimeField(auto_now_add=True)
  13. def __str__(self) -> str: # pragma: no cover
  14. return f"Lead {self.name} ({self.organization.code})"