Mercurial > public > sg101
diff bandmap/views.py @ 821:71db8076dc3d
Bandmap WIP: geocoding integrated with add form.
Add form works. Before submitting the form, client side JS makes
a geocode request to Google and populates hidden lat/lon fields
with the result. Successfully created a model instance on the
server side.
Still need to update admin dashboard, admin approval, and give
out badges for adding bands to the map. Once that is done, then
work on displaying the map with filtering.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 23 Sep 2014 20:40:31 -0500 |
parents | 9a0df7bd2409 |
children | d91356818cef |
line wrap: on
line diff
--- a/bandmap/views.py Sun Sep 21 18:20:29 2014 -0500 +++ b/bandmap/views.py Tue Sep 23 20:40:31 2014 -0500 @@ -3,10 +3,14 @@ """ from django.contrib.auth.decorators import login_required from django.shortcuts import redirect, render +from django.contrib import messages as django_messages from bandmap.forms import BandForm +SUCCESS = "Successfully submitted {} for admin review. Thanks!" + + def map_view(request): return render(request, 'bandmap/map.html') @@ -23,7 +27,8 @@ band = form.save(commit=False) band.user = request.user band.save() - redirect('bandmap-thanks') + django_messages.success(request, SUCCESS.format(band.name)) + redirect('bandmap-add') else: form = BandForm()