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