Açıklama Yok

models.py 965B

123456789101112131415161718192021222324
  1. from __future__ import annotations
  2. from django.db import models
  3. from orgs.models import Organization
  4. class Lead(models.Model):
  5. class LeadSource(models.TextChoices):
  6. CONTACT = "contact", "Contact"
  7. PICKUP_REQUEST = "pickup_request", "Pickup Request"
  8. LISTING_REQUEST = "listing_request", "Listing Request"
  9. OTHER = "other", "Other"
  10. organization = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name="leads")
  11. name = models.CharField(max_length=255)
  12. email = models.EmailField(blank=True)
  13. phone = models.CharField(max_length=64, blank=True)
  14. subject = models.CharField(max_length=255, blank=True)
  15. message = models.TextField(blank=True)
  16. source = models.CharField(max_length=64, blank=True, choices=LeadSource.choices)
  17. created_at = models.DateTimeField(auto_now_add=True)
  18. def __str__(self) -> str: # pragma: no cover
  19. return f"Lead {self.name} ({self.organization.code})"