from django.db import models from users.models import User from specializations.models import Specialization class Project(models.Model): name = models.CharField(max_length=255) price = models.DecimalField(max_digits=10, decimal_places=2) text = models.TextField(blank=True) # user = models.ForeignKey(User, related_name='projects') # specialization = models.ForeignKey(Specialization, related_name='projects', blank=True, null=True) # TODO: Make required # type_work = models.CharField() # budget = models.CharField() # cro = models.BooleanField(default=False) def __str__(self): return self.name class Meta: verbose_name = 'Проект' verbose_name_plural = 'Проекты' class Answer(models.Model): COST_TYPE_CHOICES = ( ('RUR', 'rur'), ('USD', 'usd'), ('EUR', 'eur'), ) TERM_TYPE_CHOICES = ( ('HOUR', 'hour'), ('DAY', 'day'), ('MONTH', 'month'), ) cost = models.DecimalField(max_digits=10, decimal_places=2) cost_type = models.CharField(max_length=5, choices=COST_TYPE_CHOICES, default='RUR') text = models.TextField() term = models.DecimalField(max_digits=10, decimal_places=2) term_type = models.CharField(max_length=10, choices=TERM_TYPE_CHOICES, default='hour') project = models.ForeignKey(Project, related_name='answers') user = models.ForeignKey(User, related_name='answers') def __str__(self): return self.text class Meta: verbose_name = 'Ответ к проекту' verbose_name_plural = 'Ответы к проектам' class Portfolio(models.Model): name = models.CharField(max_length=255) description = models.TextField() user = models.ForeignKey(User) def __str__(self): return self.name class PortfolioPhoto(models.Model): img = models.ImageField(upload_to='projects/portfolio') portfolio = models.ForeignKey(Portfolio) # def __str__(self): # return self.img