diff --git a/django_lostplaces/lostplaces/templates/explorer/profile_update.html b/django_lostplaces/lostplaces/templates/explorer/profile_update.html index 6e8c491..d852031 100644 --- a/django_lostplaces/lostplaces/templates/explorer/profile_update.html +++ b/django_lostplaces/lostplaces/templates/explorer/profile_update.html @@ -1,5 +1,4 @@ {% extends 'global.html'%} -{% load static %} {% load i18n %} {% load widget_tweaks %} diff --git a/django_lostplaces/lostplaces/views/explorer_views.py b/django_lostplaces/lostplaces/views/explorer_views.py index ccc10ff..5e0a134 100644 --- a/django_lostplaces/lostplaces/views/explorer_views.py +++ b/django_lostplaces/lostplaces/views/explorer_views.py @@ -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')) \ No newline at end of file