diff --git a/assets/index.js b/assets/index.js index 5f1fea7..f156436 100644 --- a/assets/index.js +++ b/assets/index.js @@ -311,8 +311,10 @@ $('[data-tooltip]').tooltip({ }()) +// Contractor experience ------------------------------- - +$('.profile-building-classifications select').select2({width: 450, placeholder: 'Выберите типы зданий'}); +$('.profile-construction-types select').select2({width: 450, placeholder: 'Выберите виды строительства'}); diff --git a/users/forms.py b/users/forms.py index ade4f21..bc4cc27 100644 --- a/users/forms.py +++ b/users/forms.py @@ -104,6 +104,21 @@ class UserProfileBasicInfoEditForm(forms.ModelForm): super().__init__(*args, **kwargs) +class UserProfileExperienceEditForm(UserProfileBasicInfoEditForm): + class Meta: + model = User + + fields = ( + 'contractor_specializations', + 'first_name', + 'last_name', + 'location', + 'patronym', + 'contractor_building_classifications', + 'contractor_construction_types', + ) + + class UserFinancialInfoEditForm(forms.ModelForm): class Meta: model = UserFinancialInfo diff --git a/users/migrations/0019_auto_20161014_2337.py b/users/migrations/0019_auto_20161014_2337.py new file mode 100644 index 0000000..b487963 --- /dev/null +++ b/users/migrations/0019_auto_20161014_2337.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-10-15 15:37 +from __future__ import unicode_literals + +from django.db import migrations, models +import mptt.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0046_merge'), + ('users', '0018_auto_20160913_0215'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='contractor_building_classifications', + field=mptt.fields.TreeManyToManyField(blank=True, related_name='contractors', to='projects.BuildingClassfication'), + ), + migrations.AddField( + model_name='user', + name='contractor_construction_types', + field=models.ManyToManyField(blank=True, related_name='contractors', to='projects.ConstructionType'), + ), + ] diff --git a/users/models.py b/users/models.py index 65871f5..d82c0ce 100644 --- a/users/models.py +++ b/users/models.py @@ -129,6 +129,10 @@ class User(AbstractBaseUser, PermissionsMixin): contractor_resume = models.OneToOneField(ContractorResume, related_name='contractor', blank=True, null=True) contractor_specializations = TreeManyToManyField(Specialization, related_name='contractors', blank=True) contractor_status = models.CharField(default='free', max_length=20, choices=STATUSES) + contractor_building_classifications = TreeManyToManyField('projects.BuildingClassfication', + related_name='contractors', blank=True) + contractor_construction_types = models.ManyToManyField('projects.ConstructionType', related_name='contractors', + blank=True) created = models.DateTimeField(default=timezone.now) cro = models.BooleanField(default=False) date_joined = models.DateTimeField(default=timezone.now) diff --git a/users/templates/user_financial_info_edit.html b/users/templates/user_financial_info_edit.html index 60eefc6..5ffb2d5 100644 --- a/users/templates/user_financial_info_edit.html +++ b/users/templates/user_financial_info_edit.html @@ -112,6 +112,9 @@
diff --git a/users/templates/user_profile_edit.html b/users/templates/user_profile_edit.html index 684f46a..d88cf7e 100644 --- a/users/templates/user_profile_edit.html +++ b/users/templates/user_profile_edit.html @@ -21,7 +21,7 @@