From 91af4089f06021ba80e0bf3180c3ac70fb560ba6 Mon Sep 17 00:00:00 2001 From: booblegum Date: Thu, 29 Dec 2016 17:59:29 +0300 Subject: [PATCH 1/2] =?UTF-8?q?PR-57=20=D0=98=D0=BA=D0=BE=D0=BD=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=B4=D0=B5=D0=BD=D1=82=D0=B8=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2=20=D1=87=D0=B0=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit У заказчика и исполнителя разные иконки в чате --- chat/templates/inc-contact-card.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chat/templates/inc-contact-card.html b/chat/templates/inc-contact-card.html index 402b160..fb3ff43 100644 --- a/chat/templates/inc-contact-card.html +++ b/chat/templates/inc-contact-card.html @@ -8,7 +8,7 @@ width: 20px; margin-right: 5px; background-size: cover; - background: url('/static/img/menu2.png') no-repeat 0 0; + background: url('{% static 'img/menu2.png' %}') no-repeat 0 0; } div.icon_mm2 { @@ -17,7 +17,7 @@ width: 20px; margin-right: 5px; background-size: cover; - background: url('/static/img/menu2.png') no-repeat 0 -20px; + background: url('{% static 'img/menu2.png' %}') no-repeat 0 -20px; } @@ -42,10 +42,10 @@ {% url "users:customer-profile-open-projects" pk=contact.pk as contact_url %} {% endif %}
- {% if request.user.is_contractor %} -
- {% else %} + {% if contact.is_contractor %}
+ {% else %} +
{% endif %} {{ contact.username }}
From 88b1a83bf33fd00e60225dfcc44c09dde171c311 Mon Sep 17 00:00:00 2001 From: booblegum Date: Thu, 29 Dec 2016 19:03:09 +0300 Subject: [PATCH 2/2] =?UTF-8?q?PR-57=20=D0=98=D0=BA=D0=BE=D0=BD=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=B4=D0=B5=D0=BD=D1=82=D0=B8=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2=20=D1=87=D0=B0=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Убрана возможность писать самому себе через свои Работы --- work_sell/templates/worksell_detail.html | 15 +++++++++--- work_sell/views.py | 29 +++++------------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/work_sell/templates/worksell_detail.html b/work_sell/templates/worksell_detail.html index 8ab8a77..c85d771 100644 --- a/work_sell/templates/worksell_detail.html +++ b/work_sell/templates/worksell_detail.html @@ -20,7 +20,7 @@ {% endif %} - + {% if object.contractor %}
@@ -28,23 +28,32 @@

{{ object.budget }}

{% if request.user.is_authenticated %} -
+ {% if not self_worksell %} + - + + {% else %} + + Это ваш заказ + + {% endif %} + {% endif %} + {% if not self_worksell %} + {% endif %}
{% endif %} diff --git a/work_sell/views.py b/work_sell/views.py index b550aae..6d74670 100644 --- a/work_sell/views.py +++ b/work_sell/views.py @@ -143,33 +143,16 @@ class WorkSellDetail(DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) + # Своя собственная Работа + self_worksell = False + if self.get_object().id in [obj.id for obj in self.request.user.work_sell.all()]: + self_worksell = True + context['worksell_related'] = WorkSell.objects.exclude(pk=self.get_object().pk)[:5] + context['self_worksell'] = self_worksell return context -# def work_sell_create(request): -# if request.is_ajax(): -# form = WorkSellForm(data=request.POST) -# if form.is_valid(): -# instance = form.save(commit=False) -# # import code; code.interact(local=dict(globals(), **locals())) -# instance.save() -# form.save_m2m() -# images_ids = request.POST.get('images-ids').split(';')[:-1] -# for pk in images_ids: -# picture = Picture.objects.get(pk=pk) -# temp_file = ContentFile(picture.file.read()) -# temp_file.name = picture.file.name -# w_photo = WorkSellPhoto() -# w_photo.img = temp_file -# w_photo.worksell = instance -# w_photo.save() -# data = {'status': 'ok'} -# else: -# data = {'status': 'no', 'form_errors': form.errors} -# return HttpResponse(json.dumps(data), content_type='application/json') - - class WorkSellCreateView(BaseMixin, View): model = WorkSell form_class = WorkSellForm