models.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from django.db import models
  2. from django.contrib.auth.models import User
  3. STATUS_CHOICES = (
  4. ('NEW', 'New Site'),
  5. ('EX', 'Existing Site'),
  6. )
  7. PRIORITY_CHOICES = (
  8. ('U', 'Urgent - 1 week or less'),
  9. ('N', 'Normal - 2 to 4 weeks'),
  10. ('L', 'Low - Still Researching'),
  11. )
  12. class Quote(models.Model):
  13. name = models.CharField(max_length=100)
  14. position = models.CharField(max_length=60, blank=True)
  15. company = models.CharField(max_length=60, blank=True)
  16. address = models.CharField(max_length=200, blank=True)
  17. phone = models.CharField(max_length=30, blank=True)
  18. email = models.EmailField()
  19. web = models.URLField(blank=True)
  20. description = models.TextField()
  21. sitestatus = models.CharField(max_length=20, choices=STATUS_CHOICES)
  22. priority = models.CharField(max_length=40, choices=PRIORITY_CHOICES)
  23. jobfile = models.FileField(upload_to='uploads/', blank=True)
  24. submitted = models.DateField(auto_now_add=True)
  25. quotedate = models.DateField(blank=True, null=True)
  26. quoteprice = models.DecimalField(decimal_places=2, max_digits=7, blank=True, default=0)
  27. username = models.ForeignKey(User, blank=True, null=True)
  28. def __str__(self):
  29. return str(self.id)