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.user }}

- {% for answer in object.answers.all %} -

{{ answer| safe }}

- {% endfor %} +
+
+
+

{{ object }}

+
+
+
+
+
+ execitor-image +
+

+ {{ object.get_full_name }} +

+ + +
+
+
+

+ Специализации: +

+
+ Интерьеры +
+
+ Визуализация/3D +
+
+
+
+
    +
  • + 13.0.2016 +
  • +
  • + Техническое сопровождение +
  • +
+
+
+

Есть допуск СРО

+
+
+
+
+
+
+
    +
  • + Местоположение: Россия, Москва +
  • +
  • + Классификация здания: Коттедж +
  • +
  • + Вид строительства: Новое +
  • +
+
+
+

+ {{ object.text }} +

+
+ +
+
+
+

Исполнители

+
+
+
+ + + +
+
+
+
+
+

Сравнить кандидатов

+
+
{% if perms.projects.add_answer %}

Оставить ответ

@@ -22,4 +126,154 @@ {% endif %} -{% endblock %}s +
+

Новые исполнители

+
+
+ + {% for answer in object.answers.all %} +
+
+
+ execitor-image +
+

+ Иванов Петр Иванович [ivanov_petr] +

+ +
Свободен
+
+
+ +
+
+

Есть допуск СРО

+
+
+
+

Цена: + {{ 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. +

+ + Ответить + +
+
+
+
+ {% endfor %} +
+
+ +
+ +{% endblock %} diff --git a/projects/templates/projects/project_form.html b/projects/templates/projects/project_form.html index 9e90c68..0bda307 100644 --- a/projects/templates/projects/project_form.html +++ b/projects/templates/projects/project_form.html @@ -1,31 +1,244 @@ {% extends "base.html" %} -{% block content %} -

Добавление

-
- - {{ form.errors }} - {% csrf_token %} - {% for field in form %} -
- {{ field.label }} - {{ field }} -
- {% endfor %} +{#

Добавление

#} +{# #} +{##} +{# {{ form.errors }}#} +{# {% csrf_token %}#} +{##} {# {% for field in form %}#} -{#
#} -{# #} +{#
#} +{# {{ field.label }}#} +{# {{ field }}#} {#
#} -{##} {# {% endfor %}#} - -{# #} -{#

{{ form.name.errors.as_text }}

#} -{# #} -{#

{{ form.price.errors.as_text }}

#} -{# #} -{#

{{ form.text.errors.as_text }}

#} -{# #} -{# #} - -{% endblock %}s \ No newline at end of file +{# #} +{# #} + + +{% block content %} +
+

Новый заказ

+
+
+ {{ form.errors }} +
{% csrf_token %} +
+

Формирование заказа

+
+

Название заказа

+ + +
+
+

Подробно опишите задание

+ +
+
+
+
+

Дополнительно

+
+
+ +
+ +

+ добавить файл (до 100 файлов)

+
+ +
    +
  • + Архитерурное 2.jpg + 7мб +
    +
  • +
  • + Архитерурное 2.jpg + 7мб +
    +
  • +
+
+

Тип работы:

+
+
+ +

Проектирование

+
+
+ +

Техническое сопровождение

+
+
+ +
+
+
+
+
+
Специализация проекта:
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
Бюджет
+
+
+
+
+ + +
+
+ +
+
+ +

или по договоренности

+
+
+
+ +

Сделать для исполнителей обязательным для заполнения поля цена и срок

+
+
+
Способ оплаты
+
+
+
+ +

+ Безопасная сделка (с резервированием бюджета) +

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro vel suscipit eaque quidem voluptate aperiam enim aut libero, excepturi architecto maxime, placeat maiores, odio itaque, ex consectetur dignissimos dicta officia. +

+
+
+ +

+ Прямая оплата Исполнителю на его кошелек/счет +

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro vel suscipit eaque quidem voluptate aperiam enim aut libero, excepturi architecto maxime, placeat maiores, odio itaque, ex consectetur dignissimos dicta officia. +

+
+
+
+
+

Расширенный поиск

+ +
+
+
+
+
+
+
+
Выбор объекта:
+
Наименование:
+
Классификация здания:
+
Вид строительства:
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
Местоположение:
+
+
+
+ +
+
+ +
+
+ +

Требуется допуск СРО

+
+
+ + +
+
+ +
+{% endblock %} diff --git a/projects/views.py b/projects/views.py index aefae7f..43d7711 100644 --- a/projects/views.py +++ b/projects/views.py @@ -52,9 +52,9 @@ class ProjectDetailView(FormMixin, DetailView): return super().form_valid(form) -class ProjectCreateView(PermissionRequiredMixin, CreateView): +class ProjectCreateView(CreateView): model = Project - permission_required = ('projects.add_project',) + # permission_required = ('projects.add_project',) raise_exception = True form_class = ProjectForm success_url = '/projects/' # TODO: Use `reverse_lazy('projects-list')` from `django.core.urlresolvers` diff --git a/templates/base.html b/templates/base.html index 50c062a..16a19c9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,121 +2,126 @@ - - - - Archilance - - - - - - - -
-
- {% block content %} {% endblock %} - -
-
- - - - - + +
+
+ {% block content %} + + {% endblock %} + +
+
+ + + + + diff --git a/templates/base2.html b/templates/base2.html index 551e43d..6b8a4bd 100644 --- a/templates/base2.html +++ b/templates/base2.html @@ -46,6 +46,8 @@

Основная задача сайта

Authed? {{ user.is_authenticated }}

+ {{ user }} + {{ user.groups.all }}
diff --git a/users/migrations/0003_user_created_at.py b/users/migrations/0003_user_created_at.py new file mode 100644 index 0000000..5f63c7f --- /dev/null +++ b/users/migrations/0003_user_created_at.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-24 10:52 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0002_team_groups'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='created_at', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 24, 10, 52, 56, 737277)), + ), + ] diff --git a/users/migrations/0004_auto_20160524_1053.py b/users/migrations/0004_auto_20160524_1053.py new file mode 100644 index 0000000..0f71065 --- /dev/null +++ b/users/migrations/0004_auto_20160524_1053.py @@ -0,0 +1,25 @@ +# -*- 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 = [ + ('users', '0003_user_created_at'), + ] + + operations = [ + migrations.RemoveField( + model_name='team', + name='groups', + ), + migrations.AlterField( + model_name='user', + name='created_at', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 24, 10, 53, 15, 497921)), + ), + ] diff --git a/users/migrations/0005_auto_20160524_1054.py b/users/migrations/0005_auto_20160524_1054.py new file mode 100644 index 0000000..4a80d14 --- /dev/null +++ b/users/migrations/0005_auto_20160524_1054.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-24 10:54 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0004_auto_20160524_1053'), + ] + + operations = [ + migrations.RemoveField( + model_name='user', + name='created_at', + ), + migrations.AddField( + model_name='user', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 24, 10, 54, 13, 805566)), + ), + ] diff --git a/users/models.py b/users/models.py index 3014677..3fe0f86 100644 --- a/users/models.py +++ b/users/models.py @@ -1,3 +1,4 @@ +from datetime import datetime from django.db import models from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, AbstractUser, Group, PermissionsMixin @@ -33,6 +34,7 @@ class User(AbstractBaseUser, PermissionsMixin): last_name = models.CharField(max_length=255, blank=True) email = models.EmailField(max_length=255, unique=True, db_index=True) is_active = models.BooleanField(default=True) + created = models.DateTimeField(default=datetime.now()) @property def is_staff(self): @@ -62,7 +64,7 @@ class Team(models.Model): name = models.CharField(max_length=255) users = models.ManyToManyField(User, related_name ='teams', blank=True) owner = models.OneToOneField(User, related_name='team', null=True) - groups = models.ManyToManyField(Group, related_name='teams', blank=True) + # groups = models.ManyToManyField(Group, related_name='teams', blank=True) def __str__(self): return self.name