From 05ba43c5ef5598af38bb822014dbc00443843a19 Mon Sep 17 00:00:00 2001 From: ArturBaybulatov Date: Mon, 1 Aug 2016 20:07:14 +0300 Subject: [PATCH] #ARC-14 --- .../management/commands/generate_projects.py | 2 +- projects/models.py | 4 +- projects/templates/project_detail.html | 258 +++++++++--------- projects/templates/project_filter.html | 2 +- projects/urls.py | 2 +- projects/views.py | 6 +- 6 files changed, 137 insertions(+), 137 deletions(-) diff --git a/archilance/management/commands/generate_projects.py b/archilance/management/commands/generate_projects.py index 4ef30fe..099330c 100644 --- a/archilance/management/commands/generate_projects.py +++ b/archilance/management/commands/generate_projects.py @@ -70,7 +70,7 @@ class Command(BaseCommand): project.specialization = Specialization.objects.root_nodes()[0].get_descendants().order_by('?').first() project.realty = Realty.objects.order_by('?').first() - project.customer = User.objects.filter(groups__name='Заказчики', is_active=True, is_superuser=False).order_by('?').first() + project.customer = User.customer_objects.filter(is_active=True).order_by('?').first() project.save() diff --git a/projects/models.py b/projects/models.py index 22618da..a296928 100644 --- a/projects/models.py +++ b/projects/models.py @@ -124,10 +124,10 @@ class Answer(models.Model): term = models.IntegerField(default=0) term_type = models.CharField(max_length=10, choices=TERMS, default='hour') text = models.TextField() - + def __str__(self): return self.text - + class Meta: verbose_name = 'Ответ к проекту' verbose_name_plural = 'Ответы к проектам' diff --git a/projects/templates/project_detail.html b/projects/templates/project_detail.html index 04f3f27..5808868 100644 --- a/projects/templates/project_detail.html +++ b/projects/templates/project_detail.html @@ -1,6 +1,5 @@ {% extends 'partials/base.html' %} -{% load staticfiles %} {% load humanize %} @@ -15,16 +14,18 @@
-

{{ project.budget | intcomma }}

+

{{ project.budget|intcomma }}

-
- execitor-image -
+ +
+ execitor-image +
+

{{ project.customer.get_full_name }} [{{ project.customer }}]

- +
    @@ -47,7 +48,6 @@
    Интерьеры
    -
    Визуализация/3D
    @@ -104,142 +104,140 @@
    - - {{ form.errors }} - {% csrf_token %} -
    - -
    -
    -

    Стоимость

    - + {% csrf_token %} + + + +
    +
    +
    +

    Стоимость

    + +
    -
    - -
    -
    -

    Бюджет

    - {{ form.currency }} + +
    +
    +

    Бюджет

    + {{ form.currency }} +
    + +
    - -
    -
    -
    -
    -
    -

    Срок

    - - +
    +
    +
    +

    Срок

    + + +
    -
    - -
    -
    -

    Тип срока

    - {{ form.term_type }} + +
    +
    +

    Тип срока

    + {{ form.term_type }} +
    + +
    - -
    -
    -
    -
    -
    -

    Текст

    - +
    +
    +
    +

    Текст

    + +
    +
    -
    -
    - -
    -
    -
    - {% for p in user.portfolio.all %} -

    {{ p }}

    - {% endfor %} + +
    +
    +
    + {% for p in user.portfolio.all %} +

    {{ p }}

    + {% endfor %} +
    +
    -
    -
    - -
    -
    -
    - - + +
    +
    +
    +
    {% for answer in project.answers.all %} -
    - -
    - - {% if answer.contractor.cro %} -
    -
    -

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

    -
    - {% endif %} - -
    -
    -

    Цена: - {{ answer.budget }} - -

    -

    - Срок: {{ answer.term }} {{ answer.term_type }} -

    -

    Опубликован: {{ answer.created }}

    -
    - -
    -{#
    #} -{#
    #} -{#

    #} -{# Иванов Петр Иванович#} -{#

    #} -{# #} -{# 13.0.2016 / 21:05#} -{# #} -{#
    #} -{# #} -{# #} -{# #} -{# #} -{# #} -{#
    #} -{#

    #} -{# Text#} -{#

    #} -{#
    #} -{#
    #} -
    -
    +
    + +
    + + {% if answer.contractor.cro %} +
    +
    +

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

    +
    + {% endif %} +
    +
    +

    Цена: + {{ answer.budget }} + +

    +

    + Срок: {{ answer.term }} {{ answer.term_type }} +

    +

    Опубликован: {{ answer.created }}

    +
    + +
    +{#
    #} +{#
    #} +{#

    #} +{# Иванов Петр Иванович#} +{#

    #} +{# #} +{# 13.0.2016 / 21:05#} +{# #} +{#
    #} +{# #} +{# #} +{# #} +{# #} +{# #} +{#
    #} +{#

    #} +{# Text#} +{#

    #} +{#
    #} +{#
    #} +
    +
    {% endfor %}
    diff --git a/projects/templates/project_filter.html b/projects/templates/project_filter.html index 2443d41..42d8861 100644 --- a/projects/templates/project_filter.html +++ b/projects/templates/project_filter.html @@ -13,7 +13,7 @@
    - --
    +
    diff --git a/projects/urls.py b/projects/urls.py index 4cc1dd4..ceb5f65 100644 --- a/projects/urls.py +++ b/projects/urls.py @@ -25,7 +25,7 @@ urlpatterns = [ urls.url(r'^create/$', CustomerProjectCreateView.as_view(), name='customer-project-create'), urls.url(r'^(?P\d+)/$', ProjectView.as_view(), name='detail'), urls.url(r'^(?P\d+)/edit/$', CustomerProjectEditView.as_view(), name='customer-project-edit'), - + urls.url(r'^(?P\d+)/trash/$', CustomerProjectTrashView.as_view(), name='customer-project-trash'), urls.url(r'^(?P\d+)/restore/$', CustomerProjectRestoreView.as_view(), name='customer-project-restore'), urls.url(r'^(?P\d+)/delete/$', CustomerProjectDeleteView.as_view(), name='customer-project-delete'), diff --git a/projects/views.py b/projects/views.py index aec9d73..ea9aef7 100644 --- a/projects/views.py +++ b/projects/views.py @@ -151,10 +151,12 @@ class ProjectView(BaseMixin, View): def get(self, request, *args, **kwargs): project = get_object_or_404(Project, pk=kwargs.get('pk')) - + context = self.get_context_data(**_.merge({}, request.GET, kwargs)) context.update({'project': project}) - + + # import code; code.interact(local=dict(globals(), **locals())) + if request.user.is_authenticated() and request.user.is_customer(): return render(request, self.customer_template_name, context) else: