From ff724245269d06d6115977a0fbd871a44cc3c440 Mon Sep 17 00:00:00 2001 From: ArturBaybulatov Date: Fri, 19 Aug 2016 17:36:42 +0300 Subject: [PATCH 1/2] Admin bug fix --- .../migrations/0013_auto_20160819_1735.py | 19 +++++++++++++++++ users/migrations/0011_auto_20160819_1735.py | 21 +++++++++++++++++++ users/models.py | 4 ++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 projects/migrations/0013_auto_20160819_1735.py create mode 100644 users/migrations/0011_auto_20160819_1735.py diff --git a/projects/migrations/0013_auto_20160819_1735.py b/projects/migrations/0013_auto_20160819_1735.py new file mode 100644 index 0000000..32cb31d --- /dev/null +++ b/projects/migrations/0013_auto_20160819_1735.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-19 14:35 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0012_project_rejected_answers_count'), + ] + + operations = [ + migrations.AlterModelOptions( + name='answermessage', + options={'ordering': ['created'], 'verbose_name': 'Отклики на проекты -- переписка', 'verbose_name_plural': 'Отклики на проекты -- переписки'}, + ), + ] diff --git a/users/migrations/0011_auto_20160819_1735.py b/users/migrations/0011_auto_20160819_1735.py new file mode 100644 index 0000000..57aa6c0 --- /dev/null +++ b/users/migrations/0011_auto_20160819_1735.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-19 14:35 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0010_auto_20160818_2131'), + ] + + operations = [ + migrations.AlterField( + model_name='contractorresume', + name='text', + field=models.TextField(blank=True, default=''), + preserve_default=False, + ), + ] diff --git a/users/models.py b/users/models.py index c2293cf..d186d23 100644 --- a/users/models.py +++ b/users/models.py @@ -81,10 +81,10 @@ class UserFinancialInfo(models.Model): class ContractorResume(models.Model): resume_file = models.FileField(upload_to='users/resume/files/', null=True, blank=True) - text = models.TextField(null=True, blank=True) + text = models.TextField(blank=True) def __str__(self): - return self.text + return str(self.pk) class Meta: verbose_name = 'Резюме' From db9d524bf9084f34b8b93c428364152e498be2b2 Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Fri, 19 Aug 2016 17:40:30 +0300 Subject: [PATCH 2/2] #ARC-4 Fixes bugs --- projects/forms.py | 1 + projects/views.py | 2 +- ratings/templatetags/specializtions_tags.py | 1 + users/templates/contractor_profile.html | 1 + users/templates/portfolio_create_form.html | 4 +++- users/templatetags/user_tags.py | 2 ++ 6 files changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/forms.py b/projects/forms.py index 75783c4..0771918 100644 --- a/projects/forms.py +++ b/projects/forms.py @@ -151,6 +151,7 @@ class RealtyForm(forms.ModelForm): class PortfolioForm(forms.ModelForm): duplicate = forms.BooleanField(required=False,label='Some label here') + images_ids = forms.CharField(required=True) class Meta: model = Portfolio diff --git a/projects/views.py b/projects/views.py index ca8d423..f921360 100644 --- a/projects/views.py +++ b/projects/views.py @@ -660,7 +660,7 @@ def contractor_portfolio_create(request): work_sell.contractor = instance.user work_sell.save() - images_ids = request.POST.get('images-ids').split(';')[:-1] + images_ids = request.POST.get('images_ids').split(';')[:-1] for pk in images_ids: picture = Picture.objects.get(pk=pk) temp_file = ContentFile(picture.file.read()) diff --git a/ratings/templatetags/specializtions_tags.py b/ratings/templatetags/specializtions_tags.py index 564e8d5..6ef72bb 100644 --- a/ratings/templatetags/specializtions_tags.py +++ b/ratings/templatetags/specializtions_tags.py @@ -15,6 +15,7 @@ def specialization_widget(context, user_id, class_name=None): 'user_id': user_id, } + @register.inclusion_tag('templatetags/specializations_widget.html', takes_context=True) def specialization_team_widget(context, team_id): team_id = int(team_id) diff --git a/users/templates/contractor_profile.html b/users/templates/contractor_profile.html index b831ce4..4bc6c16 100644 --- a/users/templates/contractor_profile.html +++ b/users/templates/contractor_profile.html @@ -604,6 +604,7 @@ }); location.reload(); } else if (data.status == 'no') { + $.each(data.form_errors, function (k, v) { $('.error-' + k).html(v).show(); }); diff --git a/users/templates/portfolio_create_form.html b/users/templates/portfolio_create_form.html index 557c16d..f8fc71d 100644 --- a/users/templates/portfolio_create_form.html +++ b/users/templates/portfolio_create_form.html @@ -98,7 +98,7 @@ - + @@ -106,6 +106,8 @@
+ {{ portfolio_form.images_ids.errors.as_text }} Выберите файлы diff --git a/users/templatetags/user_tags.py b/users/templatetags/user_tags.py index be8033c..a8bf069 100644 --- a/users/templatetags/user_tags.py +++ b/users/templatetags/user_tags.py @@ -2,6 +2,8 @@ from django import template register = template.Library() + + @register.filter('has_group') def has_group(user, group_name): groups = user.groups.all().values_list('name', flat=True)