How delete """ from my text in html element for code
<pre></pre> with pysegments (style monokai)
class UpdateAccountInfo(LoginRequiredMixin, View):
"""
View for update information about account of user
"""
def post(self, request, *args, **kwargs):
if request.is_ajax():
result = dict()
status = 200
try:
if request.FILES:
coordinates_x1 =
int(request.POST.get('coordinates[x1]'))
coordinates_y1 =
int(request.POST.get('coordinates[y1]'))
coordinates_x2 =
int(request.POST.get('coordinates[x2]'))
coordinates_y2 =
int(request.POST.get('coordinates[y2]'))
field = 'account_user_info-picture'
value = request.FILES[field]
new = {field: value}
account_info =
AccountUserInfo.objects.get(account=self.request.user)
account_info.picture = value
account_info.full_clean()
account_info.save()
picture_file = Image.open(account_info.picture.path)
cropped_picture = picture_file.crop([coordinates_x1,
coordinates_y1, coordinates_x2, coordinates_y2])
cropped_picture.save(account_info.picture.path)
result['new_image_url'] = account_info.picture.url
else:
field = self.request.POST['field']
value = self.request.POST['value']
if field == 'datetimepicker_for_birthday_account':
correct_field = 'birthday'
else:
correct_field =
field.replace('account_user_info-', '')
new = {correct_field: value}
account_info =
AccountUserInfo.objects.filter(account=self.request.user)
AccountUserInfo(**new).full_clean(exclude=['account'])
account_info.update(**new)
account_info =
AccountUserInfo.objects.get(account=self.request.user)
result['new_value_progresbar_filling_account_info'] =
account_info.filling_account_info()
except BaseException as errors:
result = dict(errors)
status = 400
return JsonResponse(data=result, status=status)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/3d900331-0681-40a2-92cb-e214d0354783%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.