harvestconnect-api / api /models /projects.py
Dayozoe's picture
feat: deploy HarvestConnect Django API with crash-proof persistent volume
a6be783 verified
Raw History Blame Contribute Delete
1.43 kB
from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
"""Tradesman/Artisan project management"""
STATUS_CHOICES = [
('inquiry', 'Inquiry'),
('quote_sent', 'Quote Sent'),
('in_progress', 'In Progress'),
('completed', 'Completed'),
('cancelled', 'Cancelled'),
]
PRIORITY_CHOICES = [
('low', 'Low'),
('medium', 'Medium'),
('high', 'High'),
]
tradesman = models.ForeignKey(User, on_delete=models.CASCADE, related_name='projects_managed')
client = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, related_name='projects_requested')
title = models.CharField(max_length=255)
description = models.TextField()
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='inquiry')
priority = models.CharField(max_length=10, choices=PRIORITY_CHOICES, default='medium')
budget = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True)
start_date = models.DateField(null=True, blank=True)
end_date = models.DateField(null=True, blank=True)
images = models.JSONField(default=list, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return f"{self.title} ({self.status})"
class Meta:
ordering = ['-created_at']