comparison 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
comparison
equal deleted inserted replaced
1096:d9cd3180c12c 1097:deed541ca79d
33 }) 33 })
34 34
35 35
36 @login_required 36 @login_required
37 def add_event(request): 37 def add_event(request):
38 thanks_flag = False
38 if request.method == 'POST': 39 if request.method == 'POST':
39 form = EventEntryForm(request.POST) 40 form = EventEntryForm(request.POST)
40 if form.is_valid(): 41 if form.is_valid():
41 event = form.save(commit=False) 42 event = form.save(commit=False)
42 event.user = request.user 43 event.user = request.user
43 event.repeat = 'none' 44 event.repeat = 'none'
44 event.save(html=form.html) 45 event.save(html=form.html)
45 return HttpResponseRedirect(reverse('gcalendar-add_thanks')) 46 return HttpResponseRedirect(reverse('gcalendar-add') + '?thanks=1')
46 else: 47 else:
47 form = EventEntryForm() 48 form = EventEntryForm()
49 thanks_flag = bool(request.GET.get('thanks', False))
48 50
49 return render(request, 'gcalendar/event.html', { 51 return render(request, 'gcalendar/event.html', {
50 'title': 'Add Calendar Event', 52 'title': 'Add Calendar Event',
51 'form': form, 53 'form': form,
52 'is_new': True, 54 'is_new': True,
55 'thanks_flag': thanks_flag,
53 'V3_DESIGN': True, 56 'V3_DESIGN': True,
54 })
55
56
57 @login_required
58 def add_thanks(request):
59 return render(request, 'gcalendar/thanks_add.html', {
60 }) 57 })
61 58
62 59
63 @login_required 60 @login_required
64 def edit_events(request): 61 def edit_events(request):
71 except InvalidPage: 68 except InvalidPage:
72 raise Http404 69 raise Http404
73 70
74 return render(request, 'gcalendar/edit.html', { 71 return render(request, 'gcalendar/edit.html', {
75 'page': page, 72 'page': page,
73 'thanks_flag': bool(request.GET.get('thanks', False)),
76 'V3_DESIGN': True, 74 'V3_DESIGN': True,
77 }) 75 })
78 76
79 77
80 @login_required 78 @login_required
89 event = form.save(commit=False) 87 event = form.save(commit=False)
90 event.user = request.user 88 event.user = request.user
91 event.repeat = 'none' 89 event.repeat = 'none'
92 event.status = Event.EDIT_REQ 90 event.status = Event.EDIT_REQ
93 event.save() 91 event.save()
94 return HttpResponseRedirect(reverse('gcalendar-edit_thanks')) 92 return HttpResponseRedirect(reverse('gcalendar-edit_events') + '?thanks=1')
95 else: 93 else:
96 form = EventEntryForm(instance=event) 94 form = EventEntryForm(instance=event)
97 95
98 return render(request, 'gcalendar/event.html', { 96 return render(request, 'gcalendar/event.html', {
99 'title': 'Change Calendar Event', 97 'title': 'Change Calendar Event',
100 'form': form, 98 'form': form,
101 'is_new': False, 99 'is_new': False,
102 'V3_DESIGN': True, 100 'V3_DESIGN': True,
103 })
104
105
106 @login_required
107 def edit_thanks(request):
108 return render(request, 'gcalendar/thanks_edit.html', {
109 }) 101 })
110 102
111 103
112 def delete_event(request): 104 def delete_event(request):
113 """This view marks an event for deletion. It is called via AJAX.""" 105 """This view marks an event for deletion. It is called via AJAX."""