diff --git a/assets/css/extra.css b/assets/css/extra.css index bed4e66..54e63e6 100644 --- a/assets/css/extra.css +++ b/assets/css/extra.css @@ -14,3 +14,18 @@ .btn-group.valProject2 a.btn > span { padding-left: 11px; } + +.btn-submit-link { + border-radius: 40px; + font-family: 'pfdintextcomppro-regular', sans-serif; + color: black; + font-size: 16px; + padding: 17px 33px 17px 33px; + float: left; + margin: 0 15px 48px 15px; + border: 1px solid #DFDFDF; + text-transform: uppercase; + letter-spacing: 2px; + color: #42B476; + border: 1px solid #42B476; +} diff --git a/projects/forms.py b/projects/forms.py index 8214835..7b2fe78 100644 --- a/projects/forms.py +++ b/projects/forms.py @@ -67,28 +67,27 @@ class PortfolioForm(ModelForm): class AnswerForm(ModelForm): - def __init__(self, *args, **kwargs): - # import code; code.interact(local=dict(globals(), **locals())) - self.project_id = kwargs.pop('project_id') - super().__init__(*args, **kwargs) - self.fields["project"].initial = self.project_id + # def __init__(self, *args, **kwargs): + # # import code; code.interact(local=dict(globals(), **locals())) + # self.project_id = kwargs.pop('project_id') + # super().__init__(*args, **kwargs) + # self.fields["project"].initial = self.project_id class Meta: model = Answer fields = ( - # 'cost', - # 'cost_type', - # 'term', - # 'term_type', - # 'text', + 'budget', + 'currency', + 'term', + 'term_type', + 'text', ) - # widgets = { - # # 'project': HiddenInput(), - # 'cost_type': Select(attrs={'class':'selectpicker'}), - # 'term_type': Select(attrs={'class':'selectpicker'}), - # } + widgets = { + 'currency': Select(attrs={'class':'selectpicker'}), + 'term_type': Select(attrs={'class':'selectpicker'}), + } class StageForm(ModelForm): class Meta: diff --git a/projects/migrations/0029_project_active.py b/projects/migrations/0029_project_active.py new file mode 100644 index 0000000..e292e83 --- /dev/null +++ b/projects/migrations/0029_project_active.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-10 11:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0028_auto_20160610_1301'), + ] + + operations = [ + migrations.AddField( + model_name='project', + name='active', + field=models.BooleanField(default=True), + ), + ] diff --git a/projects/migrations/0030_auto_20160610_1430.py b/projects/migrations/0030_auto_20160610_1430.py new file mode 100644 index 0000000..c50dcdb --- /dev/null +++ b/projects/migrations/0030_auto_20160610_1430.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-10 11:30 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0029_project_active'), + ] + + operations = [ + migrations.RenameField( + model_name='answer', + old_name='cost', + new_name='budget', + ), + migrations.RenameField( + model_name='answer', + old_name='user', + new_name='contractor', + ), + migrations.RenameField( + model_name='answer', + old_name='cost_type', + new_name='currency', + ), + ] diff --git a/projects/migrations/0031_auto_20160610_1434.py b/projects/migrations/0031_auto_20160610_1434.py new file mode 100644 index 0000000..92edae7 --- /dev/null +++ b/projects/migrations/0031_auto_20160610_1434.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-10 11:34 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0030_auto_20160610_1430'), + ] + + operations = [ + migrations.RemoveField( + model_name='project', + name='active', + ), + migrations.AddField( + model_name='project', + name='state', + field=models.CharField(choices=[('active', 'Активный'), ('trash', 'В корзине'), ('delete', 'Удален')], default='active', max_length=20), + ), + ] diff --git a/projects/models.py b/projects/models.py index 1dc8554..9327e66 100644 --- a/projects/models.py +++ b/projects/models.py @@ -89,6 +89,12 @@ class Project(models.Model): ('secure_deal', 'Безопасная сделка (с резервированием бюджета) '), ('direct_payment', 'Прямая оплата Исполнителю на его кошелек/счет'), ) + + STATES = ( + ('active', 'Активный'), + ('trash', 'В корзине'), + ('delete', 'Удален'), + ) budget = models.DecimalField(max_digits=10, decimal_places=0) budget_by_agreement = models.BooleanField(default=False) @@ -105,6 +111,7 @@ class Project(models.Model): term_type = models.CharField(max_length=20, choices=TERMS, default='hour') text = models.TextField(blank=True) work_type = models.CharField(default='1', max_length=20, choices=WORK_TYPES) + state = models.CharField(default='active', max_length=20, choices=STATES) def __str__(self): return self.name @@ -113,6 +120,11 @@ class Project(models.Model): verbose_name = 'Проект' verbose_name_plural = 'Проекты' + def secure_deal(self): + if self.deal_type == 'secure_deal': + return True + return False + class ProjectFile(models.Model): file = models.FileField(upload_to='projects/project_files') @@ -124,14 +136,14 @@ class ProjectFile(models.Model): class Answer(models.Model): - cost = models.DecimalField(max_digits=10, decimal_places=0) - cost_type = models.CharField(max_length=5, choices=CURRENCIES, default='rur') + budget = models.DecimalField(max_digits=10, decimal_places=0) + currency = models.CharField(max_length=5, choices=CURRENCIES, default='rur') created = models.DateTimeField(default=timezone.now) project = models.ForeignKey(Project, related_name='answers') term = models.IntegerField(default=0) term_type = models.CharField(max_length=10, choices=TERMS, default='hour') text = models.TextField() - user = models.ForeignKey(User, related_name='answers') + contractor = models.ForeignKey(User, related_name='answers') def __str__(self): return self.text @@ -144,7 +156,7 @@ class Answer(models.Model): class Order(models.Model): contractor = models.ForeignKey(User, null=True, blank=True) - created = models.DateTimeField(default=timezone.now, editable=False) + created = models.DateTimeField(default=timezone.now) project = models.OneToOneField(Project, related_name='order') secure = models.BooleanField(default=False) status = models.BooleanField(default=False) diff --git a/projects/templates/contractor_project_detail.html b/projects/templates/contractor_project_detail.html index b9f74b0..2a5ba55 100644 --- a/projects/templates/contractor_project_detail.html +++ b/projects/templates/contractor_project_detail.html @@ -81,7 +81,7 @@
- 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. + {{ project.text }}
Стоимость
- +Бюджет
- {{ form.cost_type }} + {{ form.currency }}@@ -172,10 +172,10 @@ {{ proj.created }}
- {{ proj.price }} + {{ proj.budget }}