Compare commits
No commits in common. "0f5474c2d3c83479447c933a8644ce73de2aa52b" and "b1aa4473e920ebb261655649f70ff326f433ec09" have entirely different histories.
0f5474c2d3
...
b1aa4473e9
@ -88,7 +88,7 @@ msgstr "Profilbild"
|
|||||||
|
|
||||||
#: models/models.py:56
|
#: models/models.py:56
|
||||||
msgid "Optional profile image for display in Explorer profile"
|
msgid "Optional profile image for display in Explorer profile"
|
||||||
msgstr "Optionales Profilbild zur Anzeige im Explorerprofil"
|
msgstr "Optionales Profilbind zur Anzeige im Explorerprofil"
|
||||||
|
|
||||||
#: models/place.py:21
|
#: models/place.py:21
|
||||||
msgid "Location"
|
msgid "Location"
|
||||||
|
@ -7,7 +7,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.contrib import messages
|
|
||||||
|
|
||||||
from lostplaces.common import get_all_subclasses
|
from lostplaces.common import get_all_subclasses
|
||||||
from lostplaces.views.base_views import IsAuthenticatedMixin
|
from lostplaces.views.base_views import IsAuthenticatedMixin
|
||||||
@ -56,21 +55,22 @@ class ExplorerProfileUpdateView(IsAuthenticatedMixin, View):
|
|||||||
return render(request, 'explorer/profile_update.html', context)
|
return render(request, 'explorer/profile_update.html', context)
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
explorer_user_change_form = ExplorerUserChangeForm(request.POST, instance=request.user)
|
explorer_change_form = ExplorerChangeForm(request.POST)
|
||||||
explorer_change_form = ExplorerChangeForm(request.POST, instance=request.user.explorer)
|
|
||||||
|
|
||||||
if explorer_change_form.is_valid() and explorer_user_change_form.is_valid():
|
if place_form.is_valid():
|
||||||
print(explorer_user_change_form)
|
submitter = request.user.explorer
|
||||||
explorer_user_change_form.save()
|
place = place_form.save(commit=False)
|
||||||
explorer_change_form.save()
|
# Save logged in user as "submitted_by"
|
||||||
|
place.submitted_by = submitter
|
||||||
|
place.save()
|
||||||
|
|
||||||
#self.handle_place_images(request, explorer)
|
self.handle_place_images(request, place)
|
||||||
|
|
||||||
messages.success(
|
messages.success(
|
||||||
self.request,
|
self.request,
|
||||||
_('Successfully updated Explorer profile')
|
_('Successfully created place')
|
||||||
)
|
)
|
||||||
return redirect(reverse_lazy('explorer_profile_update'))
|
return redirect(reverse_lazy('place_detail', kwargs={'pk': place.pk}))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Usually the browser should have checked the form before sending.
|
# Usually the browser should have checked the form before sending.
|
||||||
@ -78,5 +78,4 @@ class ExplorerProfileUpdateView(IsAuthenticatedMixin, View):
|
|||||||
self.request,
|
self.request,
|
||||||
_('Please fill in all required fields.')
|
_('Please fill in all required fields.')
|
||||||
)
|
)
|
||||||
return redirect(reverse_lazy('explorer_profile_update'))
|
return render(request, 'place/place_create.html', context={'form': place_form})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user