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.
77 lines
2.2 KiB
77 lines
2.2 KiB
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)
|
|
specialization = models.ForeignKey(Specialization, related_name='projects')
|
|
text = models.TextField(blank=True)
|
|
user = models.ForeignKey(User, related_name='projects')
|
|
|
|
# budget = models.CharField()
|
|
# cro = models.BooleanField(default=False)
|
|
# type_work = models.CharField()
|
|
|
|
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 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
|
|
|