- {#
#}
{% csrf_token %} {% if request.user.is_customer %} @@ -215,113 +211,166 @@
- Общая информация - Финансовая информация + class="btn btn-default tab-inserted active">Общая информация + Финансовая + информация
-
-
-
Дата рождения
-
- {{ form.date_of_birth }} -
-
-
-
-
-
Пол
+
+
+
+
+
Дата рождения
+
+ {{ form.date_of_birth }} +
- - -
-
- {% if request.user.is_contractor %} -
-
-
Статус
+
+
+
+
+
Имя, Фамилия, Отчество
+
- - - - {% else %} -
{{ form.organization_name.label }}
- - {% endif %} +
Резиденство
+
+ {% for residence in RESIDENCIES %} +
+ +
+ {% endfor %} +
+
Юридический статус
+
+ {% for legal_status in LEGAL_STATUSES %} +
+ +
+ {% endfor %} +
+
-
-
Skype
- -
-
-
-
Сайт
- -
-
-
Телефон
- -
-
-
Второй телефон
- -
-
-
 
- -
-
- {#
#}
@@ -329,7 +378,7 @@ {% block personal_js %} {{ block.super }} - + {# #} diff --git a/users/views.py b/users/views.py index 3ff61dd..c49caad 100644 --- a/users/views.py +++ b/users/views.py @@ -21,7 +21,7 @@ _.map = _.map_; _.filter = _.filter_ from .forms import TeamForm, ContractorResumeFilesForm, ContractorResumeForm, CustomerProfileForm -from .models import User, Team, ContractorResume, ContractorResumeFiles, TeamInvitation +from .models import User, Team, ContractorResume, ContractorResumeFiles, TeamInvitation, UserFinancialInfo from archilance import util from archilance.mixins import BaseMixin from common.mixins import ContractorRequiredMixin, NoCsrfMixin @@ -128,6 +128,10 @@ class UserProfileEditViewFull(BaseMixin, View): # import code # code.interact(local=dict(globals(), **locals())) context.update({'form': form}) + context.update({ + 'RESIDENCIES': UserFinancialInfo.RESIDENCIES, + 'LEGAL_STATUSES': UserFinancialInfo.LEGAL_STATUSES, + }) return render(request, self.template_name, context) @@ -252,188 +256,6 @@ class UserFinancialInfoEditView(BaseMixin, View): return render(request, self.template_name, context) -# class ContractorFilterViewOld(BaseMixin, View): -# template_name = 'contractor_filter.html' -# form_class = ContractorFilterForm -# -# def get(self, request, *args, **kwargs): -# form = self.form_class(request.GET, request=request) -# context = self.get_context_data(**_.merge({}, request.GET, kwargs)) -# coll = [] -# -# if form.is_valid(): -# contractors = teams = None -# contr_count = team_count = None -# get_contractors = get_teams = None -# ord = None -# -# cro = form.cleaned_data.get('cro') -# specialization = form.cleaned_data.get('specialization') -# location = form.cleaned_data.get('location') -# work_type = form.cleaned_data.get('work_type') -# build_classif = form.cleaned_data.get('building_classification') -# constr_type = form.cleaned_data.get('construction_type') -# -# party_types = form.cleaned_data.get('party_types') -# last_party_types = form.cleaned_data.get('last_party_types') -# -# if party_types == 'all': -# get_contractors = get_teams = True -# elif party_types == 'contractors': -# get_contractors = True -# elif party_types == 'teams': -# get_teams = True -# elif not party_types: -# if last_party_types == 'contractors': -# get_contractors = True -# elif last_party_types == 'teams': -# get_teams = True -# else: -# get_contractors = get_teams = True -# -# if party_types: -# last_party_types = party_types -# -# context.update({'last_party_types': last_party_types}) -# -# if get_contractors: -# contractors = User.contractor_objects.all() -# -# if cro: -# contractors = contractors.filter(cro=cro) -# -# if specialization: -# contractors = contractors.filter( -# contractor_specializations__lft__gte=specialization.lft, -# contractor_specializations__rght__lte=specialization.rght, -# ) -# -# if location: -# contractors = contractors.filter( -# location__lft__gte=location.lft, -# location__rght__lte=location.rght, -# ) -# -# if work_type: -# contractors = contractors.filter(orders__project__work_type=work_type) -# -# if build_classif: -# contractors = contractors.filter(Q(orders__project__realty__building_classification=build_classif) | -# Q(contractor_building_classifications=build_classif)) -# -# if constr_type: -# contractors = contractors.filter(Q(orders__project__realty__construction_type=constr_type) | -# Q(contractor_construction_types=constr_type)) -# -# if get_teams: -# teams = Team.objects.all() -# -# if cro: -# teams = teams.filter(Q(contractors__cro=cro) | Q(owner__cro=cro)) -# -# if specialization: -# teams = teams.filter( -# ( -# Q(contractors__contractor_specializations__lft__gte=specialization.lft) -# & Q(contractors__contractor_specializations__rght__lte=specialization.rght) -# ) | ( -# Q(owner__contractor_specializations__lft__gte=specialization.lft) -# & Q(owner__contractor_specializations__rght__lte=specialization.rght) -# ), -# ) -# -# if location: -# teams = teams.filter( -# ( -# Q(contractors__location__lft__gte=location.lft) -# & Q(contractors__location__rght__lte=location.rght) -# ) | ( -# Q(owner__location__lft__gte=location.lft) -# & Q(owner__location__rght__lte=location.rght) -# ), -# ) -# -# if work_type: -# teams = teams.filter( -# Q(contractors__orders__project__work_type=work_type) -# | Q(owner__orders__project__work_type=work_type), -# ) -# -# if build_classif: -# teams = teams.filter( -# Q(contractors__orders__project__realty__building_classification=build_classif) -# | Q(owner__orders__project__realty__building_classification=build_classif), -# ) -# -# if constr_type: -# teams = teams.filter( -# Q(contractors__orders__project__realty__construction_type=constr_type) -# | Q(owner__orders__project__realty__construction_type=constr_type), -# ) -# -# if get_contractors and get_teams: -# coll = tuple(itertools.chain(contractors.distinct(), teams.distinct())) -# count = len(coll) -# display_msg = 'Найдено %s элементов' % count if count > 0 else 'Ничего не найдено' -# elif get_contractors: -# coll = contractors.distinct() -# count = coll.count() -# display_msg = 'Найдено %s исполнителей' % count if count > 0 else 'Ничего не найдено' -# elif get_teams: -# coll = teams.distinct() -# count = coll.count() -# display_msg = 'Найдено %s групп' % count if count > 0 else 'Ничего не найдено' -# -# order_by = form.cleaned_data.get('order_by') -# last_order_by = form.cleaned_data.get('last_order_by') -# reverse_order = form.cleaned_data.get('reverse_order') -# -# if order_by: -# reverse_order = not reverse_order if order_by == last_order_by else False -# ord = order_by -# last_order_by = ord -# elif last_order_by: -# ord = last_order_by -# -# if ord: -# if ord == 'name': -# coll = natsort.natsorted(coll, key=lambda obj: getattr(obj, 'username', None) or obj.name, -# reverse=reverse_order) -# elif ord == 'created': -# coll = natsort.natsorted(coll, key=lambda obj: obj.created, reverse=reverse_order) -# -# context.update({ -# 'last_order_by': last_order_by, -# 'reverse_order': reverse_order, -# }) -# else: -# display_msg = 'Пожалуйста, введите корректные данные' -# -# if form.errors: -# messages.info(request, ( -# '

Произошла ошибка (form)

' -# '
{form}
' -# ).format(form=pformat(form.errors))) -# -# paginator = Paginator(coll, settings.PAGE_SIZE) -# page = request.GET.get('page') -# -# try: -# coll = paginator.page(page) -# except PageNotAnInteger: -# coll = paginator.page(1) -# except EmptyPage: -# coll = paginator.page(paginator.num_pages) -# -# context.update({ -# 'form': form, -# 'coll': coll, -# 'is_paginated': True, -# 'page_obj': coll, -# 'display_msg': display_msg, -# }) -# -# return render(request, self.template_name, context) # TODO: не работает сортировка по reviews(не получилось создать отзывы) и views(не нашел счетчик просмотров) class ContractorFilterView(BaseMixin, View):