def checkin(request): data = request.JSON form = CheckinForm(data) if form.is_valid(): form.save() return HttpResponse() else: return HttpResponseBadRequest()
def test_valid_data_saves(self): form = CheckinForm(self.valid_data()) form.is_valid() checkin = form.save() self.assertTrue(checkin.pk)