diff --git a/assets/css/extra.css b/assets/css/extra.css index 06e7a0b..82adab3 100644 --- a/assets/css/extra.css +++ b/assets/css/extra.css @@ -279,3 +279,28 @@ li a:active .count-tab, li a:hover .count-tab { float: none; margin: 20px auto; } + + + +.open-projects-div ul li:first-child:before { + height: 26px; + background-size: cover; + background-position: 0 0; +} + +.open-projects-div li:last-child:before { + content: ''; + position: absolute; + width: 21px; + height: 21px; + background-size: cover !important; + left: -39px; + top: -3px; +} +.open-projects-div ul li:before { + content: ''; + position: absolute; + width: 21px; + left: -39px; + top: -3px; +} diff --git a/projects/views.py b/projects/views.py index 33c3cdc..586abc0 100644 --- a/projects/views.py +++ b/projects/views.py @@ -483,7 +483,7 @@ class CustomerProjectEditView(BaseMixin, View): project = get_object_or_404(request.user.customer_projects, pk=kwargs.get('pk')) if project.order.contractor or project.order.team: - raise PermissionDenied('Заказ уже находится в работе') + raise PermissionDenied('Заказ уже находится в работе. Вы не можете его редактировать.') else: return super().dispatch(request, *args, **kwargs) @@ -599,9 +599,16 @@ class CustomerProjectTrashView(View): def dispatch(self, request, *args, **kwargs): if request.user.is_authenticated() and request.user.is_customer(): - return super().dispatch(request, *args, **kwargs) - else: - raise PermissionDenied + # Prevent editing when project's taken: + + project = get_object_or_404(request.user.customer_projects, pk=kwargs.get('pk')) + + if project.order.contractor or project.order.team: + raise PermissionDenied('Заказ уже находится в работе. Вы не можете его переместить в корзину.') + else: + return super().dispatch(request, *args, **kwargs) + + raise PermissionDenied def post(self, req, *args, **kwargs): form = self.form_class(_.merge({}, req.POST, kwargs), req=req) diff --git a/users/templates/customer_profile_current_projects.html b/users/templates/customer_profile_current_projects.html index 3382302..9fc4d9d 100644 --- a/users/templates/customer_profile_current_projects.html +++ b/users/templates/customer_profile_current_projects.html @@ -1,15 +1,15 @@ {% extends 'partials/base.html' %} {% load project_tags %} - - + + {% block content %} {% include 'partials/header.html' %} - -
{{ proj.text }}
- +{{ proj.budget }}
- + {% if request.user == proj.customer %} -