diff --git a/archilance/settings/base.py b/archilance/settings/base.py index c5472f9..13c9b8e 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -12,7 +12,7 @@ SECRET_KEY = 'vb6@b9zj7^f!^+x*e8=e!oundyu1!e*&0i(3gu2xwo4%fx4h&n' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -TEMPLATE_DEBUG = False # Show debug info in templates. See `projects/templates/project_filter.html` +TEMPLATE_DEBUG = True # Show debug info in templates. See `projects/templates/project_filter.html` ALLOWED_HOSTS = [] diff --git a/projects/models.py b/projects/models.py index 4be06fd..f7273d1 100644 --- a/projects/models.py +++ b/projects/models.py @@ -84,7 +84,7 @@ class Project(models.Model, HitCountMixin): created = models.DateTimeField(default=timezone.now) cro = models.BooleanField(default=False) currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES) - customer = models.ForeignKey(User, related_name='projects') + customer = models.ForeignKey(User, related_name='projects') # Related name should've been "customer_projects" deal_type = models.CharField(max_length=20, default='secure_deal', choices=DEAL_TYPES) name = models.CharField(max_length=255) price_and_term_required = models.BooleanField(default=False) diff --git a/projects/views.py b/projects/views.py index 4590e0d..b2ef7a1 100644 --- a/projects/views.py +++ b/projects/views.py @@ -1,5 +1,4 @@ from django.conf import settings -from django.core.exceptions import PermissionDenied from django.contrib import messages from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin from django.core.exceptions import PermissionDenied @@ -10,7 +9,6 @@ from django.db.models import Q, F from django.http import HttpResponseForbidden, HttpResponseRedirect, HttpResponse, Http404 from django.shortcuts import render, get_object_or_404, redirect from django.views.generic import ListView, DetailView, CreateView, DeleteView, View, UpdateView, TemplateView, FormView - from hitcount.models import HitCount from hitcount.views import HitCountMixin from pprint import pprint, pformat @@ -128,7 +126,7 @@ class ProjectDetailWithAnswerView(BaseMixin, View): context.update({'form': form}) return render(request, self.template_name, context) else: - return HttpResponseForbidden('403 Forbidden') + raise PermissionDenied class ProjectAnswerCreateMessageView(BaseMixin, View): @@ -138,7 +136,7 @@ class ProjectAnswerCreateMessageView(BaseMixin, View): if request.user.is_authenticated(): return super().dispatch(request, *args, **kwargs) else: - return HttpResponseForbidden('403 Forbidden') + raise PermissionDenied def post(self, request, *args, **kwargs): form = self.form_class(request.POST, request=request) @@ -515,7 +513,7 @@ class CustomerProjectTrashView(View): if request.user.is_authenticated() and request.user.is_customer(): return super().dispatch(request, *args, **kwargs) else: - return HttpResponseForbidden('403 Forbidden') + raise PermissionDenied def post(self, req, *args, **kwargs): form = self.form_class(_.merge({}, req.POST, kwargs), req=req) @@ -540,7 +538,7 @@ class CustomerProjectRestoreView(View): if request.user.is_authenticated() and request.user.is_customer(): return super().dispatch(request, *args, **kwargs) else: - return HttpResponseForbidden('403 Forbidden') + raise PermissionDenied def post(self, req, *args, **kwargs): form = self.form_class(_.merge({}, req.POST, kwargs), req=req) @@ -565,7 +563,7 @@ class CustomerProjectDeleteView(View): if request.user.is_authenticated() and request.user.is_customer(): return super().dispatch(request, *args, **kwargs) else: - return HttpResponseForbidden('403 Forbidden') + raise PermissionDenied def post(self, req, *args, **kwargs): form = self.form_class(_.merge({}, req.POST, kwargs), req=req) @@ -717,5 +715,4 @@ class PortfolioDetail(DetailView): template_name = 'portfolio_detail.html' - # import code; code.interact(local=dict(globals(), **locals())) diff --git a/templates/message.html b/templates/message.html index 0346ef0..d94db73 100644 --- a/templates/message.html +++ b/templates/message.html @@ -1,11 +1,37 @@ {% extends 'partials/base.html' %} +{% block head %} + +{% endblock %} + {% block content %} -
-
-
-

{{ message }}

+ {% include 'partials/header.html' %} + +
+
+
+

{{ message }}

+ + {% if request.user.is_authenticated %} +
+ + Вернуться на страницу личного счёта + + + (автоматически через 15 секунд) +
+ {% endif %}
+ + {% include 'partials/footer.html' %}
{% endblock %} + +{% block js_block %} + +{% endblock %} diff --git a/templates/partials/base.html b/templates/partials/base.html index 3d09907..f73f213 100644 --- a/templates/partials/base.html +++ b/templates/partials/base.html @@ -1,4 +1,6 @@ {% load staticfiles %} +{% load compress %} + @@ -7,9 +9,10 @@ + + {% block head %}{% endblock %} Archilance - {% load compress %} {% compress css %} diff --git a/templates/partials/pagination.html b/templates/partials/pagination.html index c6cf37b..f7376f0 100644 --- a/templates/partials/pagination.html +++ b/templates/partials/pagination.html @@ -53,9 +53,9 @@ {% endif %} diff --git a/users/forms.py b/users/forms.py index 887f6d9..7ab32ac 100644 --- a/users/forms.py +++ b/users/forms.py @@ -9,9 +9,9 @@ from specializations.models import Specialization class TeamForm(forms.ModelForm): - class Meta: model = Team + fields = ( 'name', 'owner', @@ -19,15 +19,14 @@ class TeamForm(forms.ModelForm): class ContractorResumeForm(forms.ModelForm): - class Meta: model = ContractorResume + fields = ( 'text', ) class ContractorResumeFilesForm(forms.ModelForm): - class Meta: model = ContractorResumeFiles diff --git a/users/templates/contractor_office.html b/users/templates/contractor_office.html index a7e23a1..4327f5a 100644 --- a/users/templates/contractor_office.html +++ b/users/templates/contractor_office.html @@ -1,18 +1,20 @@ {% extends 'partials/base.html' %} -{% load staticfiles %} {% load specializtions_tags %} {% load thumbnail %} + {% block content %} {% include 'partials/header.html' %} - +

Личный кабинет

- {% include 'partials/contractor_profile_tabs.html' with contractor_pk=request.user.pk active='groups' %} + + {% include 'partials/contractor_profile_tabs.html' %} +
-{% if contractor.is_owner_team %} -
-
-
-
-
- {% thumbnail contractor.avatar "265x264" crop="center" as im %} - profile-image - {% endthumbnail %} + + {% if contractor.is_owner_team %} +
+
+
+
+
+ {% thumbnail contractor.avatar "265x264" crop="center" as im %} + profile-image + {% endthumbnail %} +
-
- -