How delete """ from my text in html element for code 
<pre></pre> with pysegments (style monokai)

class UpdateAccountInfo(LoginRequiredMixin, View):
    &quot;&quot;&quot;
    View for update information about account of user
    &quot;&quot;&quot;

    def post(self, request, *args, **kwargs):
        if request.is_ajax():
            result = dict()
            status = 200
            try:
                if request.FILES:
                    coordinates_x1 = 
int(request.POST.get(&#39;coordinates[x1]&#39;))
                    coordinates_y1 = 
int(request.POST.get(&#39;coordinates[y1]&#39;))
                    coordinates_x2 = 
int(request.POST.get(&#39;coordinates[x2]&#39;))
                    coordinates_y2 = 
int(request.POST.get(&#39;coordinates[y2]&#39;))
                    field = &#39;account_user_info-picture&#39;
                    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[&#39;new_image_url&#39;] = account_info.picture.url
                else:
                    field = self.request.POST[&#39;field&#39;]
                    value = self.request.POST[&#39;value&#39;]
                    if field == &#39;datetimepicker_for_birthday_account&#39;:
                        correct_field = &#39;birthday&#39;
                    else:
                        correct_field = 
field.replace(&#39;account_user_info-&#39;, &#39;&#39;)
                    new = {correct_field: value}
                    account_info = 
AccountUserInfo.objects.filter(account=self.request.user)
                    
AccountUserInfo(**new).full_clean(exclude=[&#39;account&#39;])
                    account_info.update(**new)
                account_info = 
AccountUserInfo.objects.get(account=self.request.user)
                result[&#39;new_value_progresbar_filling_account_info&#39;] = 
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.

Reply via email to