diff --git a/archilance/mixins.py b/archilance/mixins.py index fa25733..f55cc5e 100644 --- a/archilance/mixins.py +++ b/archilance/mixins.py @@ -8,7 +8,7 @@ class BaseMixin(ContextMixin): c = super().get_context_data(**kwargs) pk = self.kwargs.get('pk') # Current object's ID - next = self.kwargs.get('next') # Redirect back path + next = self.kwargs.get('next') # Redirect next path back = self.kwargs.get('back') # Redirect back path if pk: c['pk'] = int(pk) diff --git a/assets/index.js b/assets/index.js index 4997f4e..0372810 100644 --- a/assets/index.js +++ b/assets/index.js @@ -1,4 +1,4 @@ -// Common ------------------------------------------------- +// Specialization select ----------------------------------- var specSelectOptions = { @@ -45,19 +45,6 @@ var specSelectOptions = { } } - - - - - - - - - - -// Specialization select ----------------------------------- - - var $specSelects = $('.-spec-select') $specSelects.select2(specSelectOptions) @@ -100,6 +87,9 @@ function updateSpecializationWidgets(specId) { + + + // Specialization select (simple) ------------------------------- @@ -146,6 +136,11 @@ $('#simpleSpecContainer').on('change', '.-simple-spec-select', function($evt) { + + + + + // Location select ---------------------------------------------- @@ -241,6 +236,11 @@ function loadRealtyDetails(realtyId) { + + + + + // File uploading --------------------------------------- @@ -292,9 +292,6 @@ $fileUploadContainer.on('click', '.existing-file-remove-btn', function($evt) { - - - // Helpers --------------------------------------------- @@ -487,6 +484,7 @@ function getLocationTree(locId) { + // Utils ----------------------------------------------- diff --git a/projects/migrations/0008_merge.py b/projects/migrations/0008_merge.py new file mode 100644 index 0000000..65a6190 --- /dev/null +++ b/projects/migrations/0008_merge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-29 17:12 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0007_auto_20160727_1835'), + ('projects', '0005_auto_20160726_1958'), + ] + + operations = [ + ] diff --git a/users/forms.py b/users/forms.py index 7c0899f..a933c42 100644 --- a/users/forms.py +++ b/users/forms.py @@ -39,14 +39,6 @@ class UserProfileEditForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.request = kwargs.pop('request') super().__init__(*args, **kwargs) - - # user = self.request.user - # - # if user.is_contractor(): - # self.fields['contractor_specializations'] = ... - - # def clean_contractor_specializations(self...): - # ... class UserFinancialInfoEditForm(forms.ModelForm): diff --git a/users/templates/user_profile_edit.html b/users/templates/user_profile_edit.html index 71c7c32..1ae32a6 100644 --- a/users/templates/user_profile_edit.html +++ b/users/templates/user_profile_edit.html @@ -46,9 +46,9 @@

Специализации

-
- - +
@@ -152,18 +152,3 @@
{% endblock %} - - -{#{% block js_block %}#} -{# #} -{#{% endblock %}#} diff --git a/users/views.py b/users/views.py index 1634113..bf4514f 100644 --- a/users/views.py +++ b/users/views.py @@ -55,11 +55,6 @@ class UserProfileEditView(BaseMixin, View): def get(self, request, *args, **kwargs): context = self.get_context_data(**_.merge({}, request.GET, kwargs)) - if request.user.is_contractor(): - root = util.get_or_none(Specialization, name='_root') - nodes = root.get_descendants('lft') - context.update({'nodes': nodes}) - form = self.form_class(request=request, instance=request.user) context.update({'form': form}) @@ -68,11 +63,15 @@ class UserProfileEditView(BaseMixin, View): def post(self, request, *args, **kwargs): context = self.get_context_data(**kwargs) customer = request.user + + # Мухтар, смотри, фишечка: + + specs = request.POST.getlist('contractor_specializations') + request.POST.setlist('contractor_specializations', _.compact(specs)) # Ignore empty input values + form = self.form_class(request.POST, request.FILES, request=request, instance=customer) if form.is_valid(): - import code; code.interact(local=dict(globals(), **locals())) - form.save() messages.info(request, 'Заказчик успешно отредактирован')