You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
3.0 KiB

from datetime import datetime
from django.db import models
from users.models import User
from specializations.models import Specialization
class Project(models.Model):
TYPE_WORK_CHOICES = (
('1', 'проектирование'),
('2', 'техническое сопровождение')
)
name = models.CharField(max_length=255)
price = models.DecimalField(max_digits=10, decimal_places=2)
specialization = models.ForeignKey(Specialization, related_name='projects')
text = models.TextField(blank=True)
user = models.ForeignKey(User, related_name='projects')
budget = models.CharField(max_length=20, blank=True)
cro = models.BooleanField(default=False)
type_work = models.CharField(max_length=20, choices=TYPE_WORK_CHOICES, default='1')
term_cost = models.BooleanField(default=False)
secure_transaction = 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')
created = models.DateTimeField(default=datetime.now())
def __str__(self):
return self.text
class Meta:
verbose_name = 'Ответ к проекту'
verbose_name_plural = 'Ответы к проектам'
class Candidate(models.Model):
user = models.ForeignKey(User, related_name='candidates')
project = models.ForeignKey(Project, related_name='candidates')
status = models.BooleanField(default=False)
def __str__(self):
pass
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 Meta:
verbose_name = 'Портфолио'
verbose_name_plural = 'Портфолио'
class PortfolioPhoto(models.Model):
img = models.ImageField(upload_to='projects/portfolio')
portfolio = models.ForeignKey(Portfolio)
class Meta:
verbose_name = 'Фото портфолио'
verbose_name_plural = 'Фото портфолио'
# def __str__(self):
# return self.img