diff gcalendar/views.py @ 1097:deed541ca79d

Get rid of GCalendar thanks pages.
author Brian Neal <bgneal@gmail.com>
date Sun, 26 Jun 2016 21:27:31 -0500
parents d9cd3180c12c
children
line wrap: on
line diff
--- a/gcalendar/views.py	Tue Jun 14 21:16:09 2016 -0500
+++ b/gcalendar/views.py	Sun Jun 26 21:27:31 2016 -0500
@@ -35,6 +35,7 @@
 
 @login_required
 def add_event(request):
+    thanks_flag = False
     if request.method == 'POST':
         form = EventEntryForm(request.POST)
         if form.is_valid():
@@ -42,25 +43,21 @@
             event.user = request.user
             event.repeat = 'none'
             event.save(html=form.html)
-            return HttpResponseRedirect(reverse('gcalendar-add_thanks'))
+            return HttpResponseRedirect(reverse('gcalendar-add') + '?thanks=1')
     else:
         form = EventEntryForm()
+        thanks_flag = bool(request.GET.get('thanks', False))
 
     return render(request, 'gcalendar/event.html', {
         'title': 'Add Calendar Event',
         'form': form,
         'is_new': True,
+        'thanks_flag': thanks_flag,
         'V3_DESIGN': True,
         })
 
 
 @login_required
-def add_thanks(request):
-    return render(request, 'gcalendar/thanks_add.html', {
-        })
-
-
-@login_required
 def edit_events(request):
     events = Event.objects.filter(user=request.user, status=Event.ON_CAL).\
             order_by('-start_date')
@@ -73,6 +70,7 @@
 
     return render(request, 'gcalendar/edit.html', {
         'page': page,
+        'thanks_flag': bool(request.GET.get('thanks', False)),
         'V3_DESIGN': True,
         })
 
@@ -91,7 +89,7 @@
             event.repeat = 'none'
             event.status = Event.EDIT_REQ
             event.save()
-            return HttpResponseRedirect(reverse('gcalendar-edit_thanks'))
+            return HttpResponseRedirect(reverse('gcalendar-edit_events') + '?thanks=1')
     else:
         form = EventEntryForm(instance=event)
 
@@ -103,12 +101,6 @@
         })
 
 
-@login_required
-def edit_thanks(request):
-    return render(request, 'gcalendar/thanks_edit.html', {
-        })
-
-
 def delete_event(request):
     """This view marks an event for deletion. It is called via AJAX."""
     if request.user.is_authenticated():