From fa1d33a41ac47cefd8b09d41f88c720dcd5528d5 Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 16 Aug 2018 02:20:16 +0500 Subject: [PATCH] LIL-582 --- api/v1/views.py | 5 +++-- apps/content/templates/content/contest.html | 14 +++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/api/v1/views.py b/api/v1/views.py index 62b3725e..cfe857fb 100644 --- a/api/v1/views.py +++ b/api/v1/views.py @@ -477,7 +477,8 @@ class ContestWorkViewSet(ExtendedModelViewSet): authentication_classes = [] def create(self, request, *args, **kwargs): - # FIXME in prod: fixed - if ContestWork.objects.filter(user=request.user).exists(): + # FIXME + user = User.objects.get(pk=request.data.get('user')) + if ContestWork.objects.filter(user=user).exists(): return Response(status=status.HTTP_400_BAD_REQUEST) return super().create(request, *args, **kwargs) diff --git a/apps/content/templates/content/contest.html b/apps/content/templates/content/contest.html index 0574ca48..f37f3886 100644 --- a/apps/content/templates/content/contest.html +++ b/apps/content/templates/content/contest.html @@ -12,9 +12,11 @@ {{ contest.description }}
- - Загрузить свою работу + {% if not contest_work_uploaded %} + Загрузить свою работу + {% endif %}
@@ -32,9 +34,11 @@
Галерея
- Загрузить свою работу + {% endif %}