Added working explorer_profile_image upload.
This commit is contained in:
		@@ -1,5 +1,4 @@
 | 
			
		||||
{% extends 'global.html'%}
 | 
			
		||||
{% load static %}
 | 
			
		||||
{% load i18n %}
 | 
			
		||||
{% load widget_tweaks %}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,26 +56,29 @@ class ExplorerProfileUpdateView(IsAuthenticatedMixin, View):
 | 
			
		||||
        return render(request, 'explorer/profile_update.html', context)
 | 
			
		||||
 | 
			
		||||
    def post(self, request, *args, **kwargs):
 | 
			
		||||
        explorer_user_change_form = ExplorerUserChangeForm(request.POST, instance=request.user)
 | 
			
		||||
        explorer_change_form = ExplorerChangeForm(request.POST, instance=request.user.explorer)
 | 
			
		||||
        explorer_user_change_form = ExplorerUserChangeForm(
 | 
			
		||||
            request.POST,
 | 
			
		||||
            instance=request.user
 | 
			
		||||
            )
 | 
			
		||||
        explorer_change_form = ExplorerChangeForm(
 | 
			
		||||
            request.POST,
 | 
			
		||||
            request.FILES,
 | 
			
		||||
            instance=request.user.explorer
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        if explorer_change_form.is_valid() and explorer_user_change_form.is_valid():
 | 
			
		||||
            explorer_user_change_form.save()
 | 
			
		||||
            explorer_change_form.save()
 | 
			
		||||
 | 
			
		||||
            #self.handle_place_images(request, explorer)
 | 
			
		||||
            
 | 
			
		||||
            messages.success(
 | 
			
		||||
                self.request,
 | 
			
		||||
                _('Successfully updated Explorer profile')
 | 
			
		||||
            )
 | 
			
		||||
            return redirect(reverse_lazy('explorer_profile_update'))
 | 
			
		||||
        
 | 
			
		||||
        else:
 | 
			
		||||
            # Usually the browser should have checked the form before sending.
 | 
			
		||||
            messages.error(
 | 
			
		||||
                self.request,
 | 
			
		||||
                _('Please fill in all required fields.')
 | 
			
		||||
            )
 | 
			
		||||
            return redirect(reverse_lazy('explorer_profile_update'))
 | 
			
		||||
        return redirect(reverse_lazy('explorer_profile_update'))
 | 
			
		||||
    
 | 
			
		||||
		Reference in New Issue
	
	Block a user