diff --git a/.gitignore b/.gitignore index 5c00400..cf2bf01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ *.pyc .idea/ env/ +.ar/ +ar/ + diff --git a/archilance/settings/dev.py b/archilance/settings/dev.py index 012ec93..8fc56c2 100644 --- a/archilance/settings/dev.py +++ b/archilance/settings/dev.py @@ -1,5 +1,5 @@ from .base import * -# INSTALLED_APPS += ['debug_toolbar'] +INSTALLED_APPS += ['debug_toolbar'] AUTH_PASSWORD_VALIDATORS = [] diff --git a/archilance/urls.py b/archilance/urls.py index addbc88..d6f7aa8 100644 --- a/archilance/urls.py +++ b/archilance/urls.py @@ -11,7 +11,7 @@ urlpatterns = [ url(r'^$', HomeTemplateView.as_view()), url(r'^test/$', TemplateView.as_view(template_name='test.html'), name='test'), url(r'^projects/', include('projects.urls')), - url(r'^specialization/', include('specializations.urls')), + url(r'^specializations/', include('specializations.urls')), url(r'^users/', include('registration.backends.default.urls')), url(r'^users/', include('users.urls')), url(r'^admin/', admin.site.urls), diff --git a/assets/js/main.js b/assets/js/main.js index c95be8d..8a84a48 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -3,7 +3,8 @@ $(document).ready(function(){ $('.messd:first').addClass('mesAct'); $('.orderBlock:first').addClass('orAct'); - $('.resButtonF1').click(function(){ + $('.resButtonF1').click(function(e){ + e.preventDefault(); $('.slideRes').toggleClass('activeSlide'); if($('.slideRes').hasClass('activeSlide')) { $('.slideRes').slideUp(300); @@ -49,4 +50,4 @@ $(document).ready(function(){ width: '117px' }); -}); \ No newline at end of file +}); diff --git a/media/projects/portfolio/gal.jpg b/media/projects/portfolio/gal.jpg new file mode 100644 index 0000000..84a447a Binary files /dev/null and b/media/projects/portfolio/gal.jpg differ diff --git a/media/projects/portfolio/meet-the-team-image-2.jpg b/media/projects/portfolio/meet-the-team-image-2.jpg new file mode 100644 index 0000000..8327485 Binary files /dev/null and b/media/projects/portfolio/meet-the-team-image-2.jpg differ diff --git a/projects/admin.py b/projects/admin.py index 5e6a1b6..ad30f53 100644 --- a/projects/admin.py +++ b/projects/admin.py @@ -1,8 +1,20 @@ from django.contrib import admin -from .models import Project, Portfolio, PortfolioPhoto, Answer +from .models import Project, Portfolio, PortfolioPhoto, Answer, Realty, Candidate, Order + + +# class UserAdmin(admin.ModelAdmin): +# readonly_fields = ('pk',) +# list_display = ('email','is_active',) +# +# def get_groups(self, obj): +# return ', '.join(g.name for g in obj.groups.all()) + admin.site.register(Project) admin.site.register(Answer) admin.site.register(Portfolio) admin.site.register(PortfolioPhoto) +admin.site.register(Realty) +admin.site.register(Order) +admin.site.register(Candidate) diff --git a/projects/forms.py b/projects/forms.py index c522833..c4b5d51 100644 --- a/projects/forms.py +++ b/projects/forms.py @@ -1,18 +1,39 @@ -from django.forms import ModelForm, HiddenInput -from .models import Project, Portfolio, Answer +from django import forms +from django.forms import ModelForm, HiddenInput, Form +from django.forms.models import inlineformset_factory +from .models import Project, Portfolio, Answer, Realty, PortfolioPhoto + +# RealtyFormSet = inlineformset_factory(Project, Realty) class ProjectForm(ModelForm): class Meta: model = Project - fields = ( 'name', 'price', 'specialization', 'text', + 'type_work', + 'secure_transaction', ) + +class ProjectsForm(Form): + name = forms.CharField(max_length=255) + + +class RealtyForm(ModelForm): + class Meta: + model = Realty + fields = ( + 'name', + 'building_classification', + 'type_construction', + 'country', + 'city', + ) + class PortfolioForm(ModelForm): class Meta: model = Portfolio @@ -39,3 +60,6 @@ class AnswerForm(ModelForm): widgets = { 'project': HiddenInput(), } + +from django.forms.models import inlineformset_factory +PortfolioPhotoFormSet = inlineformset_factory(Portfolio, PortfolioPhoto, fields=('img',)) diff --git a/projects/migrations/0007_auto_20160525_0948.py b/projects/migrations/0007_auto_20160525_0948.py new file mode 100644 index 0000000..311806e --- /dev/null +++ b/projects/migrations/0007_auto_20160525_0948.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-25 09:48 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0006_auto_20160524_1208'), + ] + + operations = [ + migrations.AlterField( + model_name='answer', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 25, 9, 48, 35, 275911)), + ), + ] diff --git a/projects/migrations/0008_auto_20160525_1044.py b/projects/migrations/0008_auto_20160525_1044.py new file mode 100644 index 0000000..71edc9f --- /dev/null +++ b/projects/migrations/0008_auto_20160525_1044.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-25 10:44 +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', '0007_auto_20160525_0948'), + ] + + operations = [ + migrations.CreateModel( + name='Realty', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('building_classification', models.CharField(max_length=50)), + ('type_construction', models.CharField(max_length=50)), + ('country', models.CharField(max_length=50)), + ('city', models.CharField(max_length=50)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='realty', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.AlterField( + model_name='answer', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 25, 10, 44, 29, 360210)), + ), + migrations.AddField( + model_name='project', + name='realty', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='projects.Realty'), + ), + ] diff --git a/projects/migrations/0009_auto_20160525_1524.py b/projects/migrations/0009_auto_20160525_1524.py new file mode 100644 index 0000000..6f35dc9 --- /dev/null +++ b/projects/migrations/0009_auto_20160525_1524.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-25 15:24 +from __future__ import unicode_literals + +import datetime +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('projects', '0008_auto_20160525_1044'), + ] + + operations = [ + migrations.CreateModel( + name='Order', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('cost', models.DecimalField(decimal_places=2, max_digits=10)), + ('term', models.IntegerField(default=1)), + ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False)), + ('status', models.BooleanField(default=False)), + ('contractor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('project', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='order', to='projects.Project')), + ], + ), + migrations.AlterModelOptions( + name='realty', + options={'verbose_name': 'Объект', 'verbose_name_plural': 'Объекты'}, + ), + migrations.AlterField( + model_name='answer', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 25, 15, 24, 2, 462642)), + ), + ] diff --git a/projects/migrations/0010_auto_20160525_1525.py b/projects/migrations/0010_auto_20160525_1525.py new file mode 100644 index 0000000..77bc8e9 --- /dev/null +++ b/projects/migrations/0010_auto_20160525_1525.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-25 15:25 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0009_auto_20160525_1524'), + ] + + operations = [ + migrations.AlterField( + model_name='answer', + name='created', + field=models.DateTimeField(default=datetime.datetime(2016, 5, 25, 15, 25, 42, 489763, tzinfo=utc)), + ), + ] diff --git a/projects/migrations/0011_auto_20160525_1526.py b/projects/migrations/0011_auto_20160525_1526.py new file mode 100644 index 0000000..601de14 --- /dev/null +++ b/projects/migrations/0011_auto_20160525_1526.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-25 15:26 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0010_auto_20160525_1525'), + ] + + operations = [ + migrations.AlterField( + model_name='answer', + name='created', + field=models.DateTimeField(default=django.utils.timezone.now), + ), + ] diff --git a/projects/models.py b/projects/models.py index 31ef9fe..dabf112 100644 --- a/projects/models.py +++ b/projects/models.py @@ -1,10 +1,33 @@ from datetime import datetime from django.db import models +from django.utils import timezone from users.models import User from specializations.models import Specialization +class Realty(models.Model): + BUILDING_CLASSIFICATION_CHOICES = ( + + ) + TYPE_CONSTRUCTION_CHOICES = ( + + ) + name = models.CharField(max_length=255) + building_classification = models.CharField(max_length=50) + type_construction = models.CharField(max_length=50) + country = models.CharField(max_length=50) + city = models.CharField(max_length=50) + user = models.ForeignKey(User, related_name='realty') + + def __str__(self): + return self.name + + class Meta: + verbose_name = 'Объект' + verbose_name_plural = 'Объекты' + + class Project(models.Model): TYPE_WORK_CHOICES = ( ('1', 'проектирование'), @@ -21,6 +44,7 @@ class Project(models.Model): 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) + realty = models.ForeignKey(Realty, null=True, related_name='projects') def __str__(self): return self.name @@ -30,6 +54,22 @@ class Project(models.Model): verbose_name_plural = 'Проекты' +class Order(models.Model): + project = models.OneToOneField(Project, related_name='order') + contractor = models.ForeignKey(User) + cost = models.DecimalField(max_digits=10, decimal_places=2) + term = models.IntegerField(default=1) + created = models.DateTimeField(default=timezone.now, editable=False) + status = models.BooleanField(default=False) + + def __str__(self): + return self.project.name + + class Meta: + verbose_name = 'Заказ' + verbose_name_plural = 'Заказы' + + class Answer(models.Model): COST_TYPE_CHOICES = ( ('rur', 'rur'), @@ -50,7 +90,7 @@ class Answer(models.Model): 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()) + created = models.DateTimeField(default=timezone.now) def __str__(self): return self.text @@ -75,7 +115,7 @@ class Candidate(models.Model): class Portfolio(models.Model): name = models.CharField(max_length=255) description = models.TextField() - user = models.ForeignKey(User) + user = models.ForeignKey(User,related_name='portfolio') def __str__(self): return self.name @@ -95,3 +135,6 @@ class PortfolioPhoto(models.Model): # def __str__(self): # return self.img + + + diff --git a/projects/templates/projects/project_form.html b/projects/templates/projects/project_form.html index 0bda307..9e5d3d0 100644 --- a/projects/templates/projects/project_form.html +++ b/projects/templates/projects/project_form.html @@ -1,244 +1,245 @@ {% extends "base.html" %} -{#
Новый заказ
-или по договоренности
-Сделать для исполнителей обязательным для заполнения поля цена и срок
-- Безопасная сделка (с резервированием бюджета) -
-- 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. -
-Расширенный поиск
- -Новый заказ
+Формирование заказа
+Название заказа
+ + {{ form.name.errors }} +Подробно опишите задание
+ ++ добавить файл (до 100 файлов)
#} +{#Тип работы:
+Проектирование
+Техническое сопровождение
+или по договоренности
+Сделать для исполнителей обязательным для заполнения поля цена и срок
++ Безопасная сделка (с резервированием бюджета) +
++ Текст +
++ Прямая оплата Исполнителю на его кошелек/счет +
++ Текст +
+Расширенный поиск
+ +{{ ch }}
+ {% for ch1 in ch.get_children %} + {# {{ ch1 }}#} + {% endfor %} + {% endfor %} + {% block js_block %} + + {% endblock %} +{% endblock %} + diff --git a/specializations/urls.py b/specializations/urls.py index 03cbe75..28730fd 100644 --- a/specializations/urls.py +++ b/specializations/urls.py @@ -1,8 +1,12 @@ from django.conf import urls # from django.contrib.auth.views import login, logout -from .views import SpecListView +from .views import SpecListView, SpecChildrenDetailView, test_page, test_spec urlpatterns = [ urls.url(r'^$', SpecListView.as_view(), name='spec-list'), -] \ No newline at end of file + urls.url(r'^test/$', test_page), + urls.url(r'^spectest/$', test_spec), + urls.url(r'^children/(?P