Commits

Luke Plant committed 4e4b6d9

Implemented 'add another' button on 'list bookings' page

Comments (0)

Files changed (2)

cciw/bookings/tests.py

         self.assertContains(resp, "id_book_now_btn")
         # Total:
         self.assertContains(resp, "£100.01")
+
+    def test_add_another_btn(self):
+        self.login()
+        self.create_place()
+        resp = self.client.post(reverse('cciw.bookings.views.list_bookings'), {'add_another': '1'})
+        self.assertEqual(302, resp.status_code)
+        newpath = reverse('cciw.bookings.views.add_place')
+        self.assertTrue(resp['Location'].endswith(newpath))
+

cciw/bookings/views.py

         c['total'] = total
         return c
 
+    def post(self, request, *args, **kwargs):
+        if 'add_another' in request.POST:
+            return HttpResponseRedirect(reverse('cciw.bookings.views.add_place'))
+        return self.get(request, *args, **kwargs)
+
 
 index = BookingIndex.as_view()
 start = BookingStart.as_view()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.