#ARC-4 Fixes bugs

remotes/origin/PR-39
Mukhtar 10 years ago
parent 0262becda0
commit db9d524bf9
  1. 1
      projects/forms.py
  2. 2
      projects/views.py
  3. 1
      ratings/templatetags/specializtions_tags.py
  4. 1
      users/templates/contractor_profile.html
  5. 4
      users/templates/portfolio_create_form.html
  6. 2
      users/templatetags/user_tags.py

@ -151,6 +151,7 @@ class RealtyForm(forms.ModelForm):
class PortfolioForm(forms.ModelForm): class PortfolioForm(forms.ModelForm):
duplicate = forms.BooleanField(required=False,label='Some label here') duplicate = forms.BooleanField(required=False,label='Some label here')
images_ids = forms.CharField(required=True)
class Meta: class Meta:
model = Portfolio model = Portfolio

@ -660,7 +660,7 @@ def contractor_portfolio_create(request):
work_sell.contractor = instance.user work_sell.contractor = instance.user
work_sell.save() 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: for pk in images_ids:
picture = Picture.objects.get(pk=pk) picture = Picture.objects.get(pk=pk)
temp_file = ContentFile(picture.file.read()) temp_file = ContentFile(picture.file.read())

@ -15,6 +15,7 @@ def specialization_widget(context, user_id, class_name=None):
'user_id': user_id, 'user_id': user_id,
} }
@register.inclusion_tag('templatetags/specializations_widget.html', takes_context=True) @register.inclusion_tag('templatetags/specializations_widget.html', takes_context=True)
def specialization_team_widget(context, team_id): def specialization_team_widget(context, team_id):
team_id = int(team_id) team_id = int(team_id)

@ -604,6 +604,7 @@
}); });
location.reload(); location.reload();
} else if (data.status == 'no') { } else if (data.status == 'no') {
$.each(data.form_errors, function (k, v) { $.each(data.form_errors, function (k, v) {
$('.error-' + k).html(v).show(); $('.error-' + k).html(v).show();
}); });

@ -98,7 +98,7 @@
</div> </div>
<input type="hidden" name="{{ portfolio_form.user.html_name }}" value="{{ request.user.pk }}"/> <input type="hidden" name="{{ portfolio_form.user.html_name }}" value="{{ request.user.pk }}"/>
<input type="hidden" name="images-ids" id="upload-files-pk"/> <input type="hidden" name="{{ portfolio_form.images_ids.html_name }}" id="upload-files-pk"/>
</div> </div>
</div> </div>
@ -106,6 +106,8 @@
<!-- The fileinput-button span is used to style the file input field as button --> <!-- The fileinput-button span is used to style the file input field as button -->
<div class="textAreaBlock2 polsF1 text-nn box-sizing disTab" style="margin-bottom: 12px;"> <div class="textAreaBlock2 polsF1 text-nn box-sizing disTab" style="margin-bottom: 12px;">
<span style="color: red; margin-left:8px; font-size: 12px;"
class="error-{{ portfolio_form.images_ids.html_name }}">{{ portfolio_form.images_ids.errors.as_text }}</span>
<span class="btn btn-success fileinput-button add_file_to_port"> <span class="btn btn-success fileinput-button add_file_to_port">
<span>Выберите файлы</span> <span>Выберите файлы</span>
<input id="fileupload" type="file" name="file" multiple value=""> <input id="fileupload" type="file" name="file" multiple value="">

@ -2,6 +2,8 @@ from django import template
register = template.Library() register = template.Library()
@register.filter('has_group') @register.filter('has_group')
def has_group(user, group_name): def has_group(user, group_name):
groups = user.groups.all().values_list('name', flat=True) groups = user.groups.all().values_list('name', flat=True)

Loading…
Cancel
Save