From a62d6c0c95382c4fcfa5e074bec552995ad88fbb Mon Sep 17 00:00:00 2001 From: ArturBaybulatov Date: Fri, 16 Sep 2016 22:01:50 +0300 Subject: [PATCH] Fixes --- .../migrations/0035_auto_20160916_2003.py | 20 ++++++++ projects/models.py | 5 ++ projects/templates/comparison.html | 4 +- projects/templates/project_detail.html | 46 +++++++++++-------- .../customer_profile_open_projects.html | 12 +++-- .../partials/customer_profile_info_block.html | 18 ++++---- 6 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 projects/migrations/0035_auto_20160916_2003.py diff --git a/projects/migrations/0035_auto_20160916_2003.py b/projects/migrations/0035_auto_20160916_2003.py new file mode 100644 index 0000000..ae886bd --- /dev/null +++ b/projects/migrations/0035_auto_20160916_2003.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-16 17:03 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0034_auto_20160916_1933'), + ] + + operations = [ + migrations.AlterField( + model_name='stage', + name='term', + field=models.DateField(), + ), + ] diff --git a/projects/models.py b/projects/models.py index 3a97c1c..75a4f57 100644 --- a/projects/models.py +++ b/projects/models.py @@ -163,6 +163,11 @@ class Answer(models.Model): class AnswerMessage(models.Model): + # Get a message's author: + # + # customer: `message.is_sender_customer and message.answer.project.customer` + # contractor/team: `not message2.is_sender_customer and message2.contractor_or_team` + answer = models.ForeignKey(Answer, related_name='messages') created = models.DateTimeField(default=timezone.now) is_sender_customer = models.BooleanField(default=False) diff --git a/projects/templates/comparison.html b/projects/templates/comparison.html index 31b097a..73a7e82 100644 --- a/projects/templates/comparison.html +++ b/projects/templates/comparison.html @@ -36,9 +36,9 @@ {% if cand.answer.author|class_name == 'User' %} - {{ cand.answer.author.get_full_name }} + {% firstof cand.answer.author.get_full_name.strip cand.answer.author.username %} {% elif cand.answer.author|class_name == 'Team' %} - {{ cand.answer.author.name }} + {% firstof cand.answer.author.name.strip cand.answer.author.username %} {% endif %} diff --git a/projects/templates/project_detail.html b/projects/templates/project_detail.html index d954d47..6759da1 100644 --- a/projects/templates/project_detail.html +++ b/projects/templates/project_detail.html @@ -5,6 +5,16 @@ {% load specializtions_tags %} {% load project_tags %} + +{% block head_css %} + +{% endblock %} + + {% block content %} {% include 'partials/header.html' %} @@ -332,17 +342,17 @@
{% for message in answer.messages.all %}
-
+
{% if message.is_sender_customer %} -

- {{ project.customer.get_full_name }} +

+ {% firstof project.customer.get_full_name.strip project.customer.username %}

{% else %} -

+

{% if answer.author|class_name == 'User' %} - {{ answer.author.get_full_name }} + {% firstof answer.author.get_full_name.strip answer.author.username %} {% elif answer.author|class_name == 'Team' %} - {{ answer.author.name }} + {% firstof answer.author.name.strip answer.author.owner.username %} {% endif %}

{% endif %} @@ -705,17 +715,17 @@
{% for message in answer.messages.all %}
-
+
{% if message.is_sender_customer %}

- {{ project.customer.get_full_name }} + {% firstof project.customer.get_full_name.strip project.customer.username %}

{% else %}

{% if answer.author|class_name == 'User' %} - {{ answer.author.get_full_name }} + {% firstof answer.author.get_full_name.strip answer.author.username %} {% elif answer.author|class_name == 'Team' %} - {{ answer.author.name }} + {% firstof answer.author.name.strip answer.author.owner.username %} {% endif %}

{% endif %} @@ -899,17 +909,17 @@
{% for message in answer.messages.all %}
-
+
{% if message.is_sender_customer %}

- {{ project.customer.get_full_name }} + {% firstof project.customer.get_full_name.strip project.customer.username %}

{% else %}

{% if answer.author|class_name == 'User' %} - {{ answer.author.get_full_name }} + {% firstof answer.author.get_full_name.strip answer.author.username %} {% elif answer.author|class_name == 'Team' %} - {{ answer.author.name }} + {% firstof answer.author.name.strip answer.author.owner.username %} {% endif %}

{% endif %} @@ -1071,17 +1081,17 @@
{% for message in answer.messages.all %}
-
+
{% if message.is_sender_customer %}

- {{ project.customer.get_full_name }} + {% firstof project.customer.get_full_name.strip project.customer.username %}

{% else %}

{% if answer.author|class_name == 'User' %} - {{ answer.author.get_full_name }} + {% firstof answer.author.get_full_name.strip answer.author.username %} {% elif answer.author|class_name == 'Team' %} - {{ answer.author.name }} + {% firstof answer.author.name.strip answer.author.owner.username %} {% endif %}

{% endif %} diff --git a/users/templates/customer_profile_open_projects.html b/users/templates/customer_profile_open_projects.html index 9e112be..9a02670 100644 --- a/users/templates/customer_profile_open_projects.html +++ b/users/templates/customer_profile_open_projects.html @@ -53,11 +53,13 @@
  • {{ proj.get_team_answers|length }} ответ от имени группы
  • - + {% if request.user == customer %} + + {% endif %}

    {{ proj.text }} diff --git a/users/templates/partials/customer_profile_info_block.html b/users/templates/partials/customer_profile_info_block.html index b563a4b..eef5778 100644 --- a/users/templates/partials/customer_profile_info_block.html +++ b/users/templates/partials/customer_profile_info_block.html @@ -53,14 +53,16 @@ Открытые проекты -

  • - Текущие проекты - -
    -
    0
    -
    0
    -
    -
  • + {% if request.user == customer %} +
  • + Текущие проекты + +
    +
    0
    +
    0
    +
    +
  • + {% endif %}
  • Отзывы