diff --git a/projects/migrations/0005_auto_20160524_1053.py b/projects/migrations/0005_auto_20160524_1053.py new file mode 100644 index 0000000..823426b --- /dev/null +++ b/projects/migrations/0005_auto_20160524_1053.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-24 10:53 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0004_auto_20160519_1338'), + ] + + operations = [ + migrations.AlterModelOptions( + name='portfolio', + options={'verbose_name': 'Портфолио', 'verbose_name_plural': 'Портфолио'}, + ), + migrations.AlterModelOptions( + name='portfoliophoto', + options={'verbose_name': 'Фото портфолио', 'verbose_name_plural': 'Фото портфолио'}, + ), + migrations.AddField( + model_name='answer', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 24, 10, 53, 28, 347882)), + ), + migrations.AlterField( + model_name='answer', + name='cost_type', + field=models.CharField(choices=[('rur', 'rur'), ('usd', 'usd'), ('eur', 'eur')], default='RUR', max_length=5), + ), + migrations.AlterField( + model_name='answer', + name='term_type', + field=models.CharField(choices=[('hour', 'hour'), ('day', 'day'), ('month', 'month')], default='HOUR', max_length=10), + ), + ] diff --git a/projects/migrations/0006_auto_20160524_1208.py b/projects/migrations/0006_auto_20160524_1208.py new file mode 100644 index 0000000..33afe73 --- /dev/null +++ b/projects/migrations/0006_auto_20160524_1208.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-24 12:08 +from __future__ import unicode_literals + +import datetime +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('projects', '0005_auto_20160524_1053'), + ] + + operations = [ + migrations.CreateModel( + name='Candidate', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.BooleanField(default=False)), + ], + options={ + 'verbose_name': 'Кандидат', + 'verbose_name_plural': 'Кандидаты', + }, + ), + migrations.AddField( + model_name='project', + name='budget', + field=models.CharField(blank=True, max_length=20), + ), + migrations.AddField( + model_name='project', + name='cro', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='project', + name='secure_transaction', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='project', + name='term_cost', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='project', + name='type_work', + field=models.CharField(choices=[('1', 'проектирование'), ('2', 'техническое сопровождение')], default='1', max_length=20), + ), + migrations.AlterField( + model_name='answer', + name='cost_type', + field=models.CharField(choices=[('rur', 'rur'), ('usd', 'usd'), ('eur', 'eur')], default='rur', max_length=5), + ), + migrations.AlterField( + model_name='answer', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 24, 12, 8, 51, 751897)), + ), + migrations.AlterField( + model_name='answer', + name='term_type', + field=models.CharField(choices=[('hour', 'hour'), ('day', 'day'), ('month', 'month')], default='hour', max_length=10), + ), + migrations.AddField( + model_name='candidate', + name='project', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='candidates', to='projects.Project'), + ), + migrations.AddField( + model_name='candidate', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='candidates', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/projects/models.py b/projects/models.py index b9732d0..31ef9fe 100644 --- a/projects/models.py +++ b/projects/models.py @@ -1,3 +1,4 @@ +from datetime import datetime from django.db import models from users.models import User @@ -5,15 +6,21 @@ 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() - # cro = models.BooleanField(default=False) - # type_work = models.CharField() + 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 @@ -37,12 +44,13 @@ class Answer(models.Model): ) cost = models.DecimalField(max_digits=10, decimal_places=2) - cost_type = models.CharField(max_length=5, choices=COST_TYPE_CHOICES, default='RUR') + 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') + 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 @@ -52,6 +60,18 @@ class Answer(models.Model): 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() diff --git a/projects/templates/projects/project_detail.html b/projects/templates/projects/project_detail.html index fcd4ab3..7aa812f 100644 --- a/projects/templates/projects/project_detail.html +++ b/projects/templates/projects/project_detail.html @@ -1,11 +1,115 @@ {% extends "base.html" %} +{#{% block content %}#} + + +{#{% endblock %}#} {% block content %} -
{{ object }}
++ Специализации: +
+Есть допуск СРО
++ {{ object.text }} +
+Исполнители
+Сравнить кандидатов
+Новые исполнители
+Есть допуск СРО
+Цена: + {{ answer.cost }} + +
++ Срок: {{ answer.term }} {{ answer.term_type }} +
+Опубликован:{{ answer.created }}
++ Иванов Петр Иванович +
+ + 13.0.2016 / 21:05 + ++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. +
++ Иванов Петр Иванович +
+ + 13.0.2016 / 21:05 + ++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. +
+ + Ответить + +