Exemplo n.º 1
0
 def get_form(self, expected_valid):
     """
     Return a form bound to self.form_data, asserting its validity (or lack
     thereof) according to expected_valid
     """
     form = ThreadListGetForm(self.form_data)
     self.assertEqual(form.is_valid(), expected_valid)
     return form
Exemplo n.º 2
0
 def get_form(self, expected_valid):
     """
     Return a form bound to self.form_data, asserting its validity (or lack
     thereof) according to expected_valid
     """
     form = ThreadListGetForm(self.form_data)
     self.assertEqual(form.is_valid(), expected_valid)
     return form
Exemplo n.º 3
0
 def list(self, request):
     """
     Implements the GET method for the list endpoint as described in the
     class docstring.
     """
     form = ThreadListGetForm(request.GET)
     if not form.is_valid():
         raise ValidationError(form.errors)
     return Response(
         get_thread_list(request, form.cleaned_data["course_id"],
                         form.cleaned_data["page"],
                         form.cleaned_data["page_size"]))
Exemplo n.º 4
0
 def list(self, request):
     """
     Implements the GET method for the list endpoint as described in the
     class docstring.
     """
     form = ThreadListGetForm(request.GET)
     if not form.is_valid():
         raise ValidationError(form.errors)
     return get_thread_list(
         request, form.cleaned_data["course_id"], form.cleaned_data["page"],
         form.cleaned_data["page_size"], form.cleaned_data["topic_id"],
         form.cleaned_data["text_search"], form.cleaned_data["following"],
         form.cleaned_data["view"], form.cleaned_data["order_by"],
         form.cleaned_data["order_direction"],
         form.cleaned_data["requested_fields"])
Exemplo n.º 5
0
 def list(self, request):
     """
     Implements the GET method for the list endpoint as described in the
     class docstring.
     """
     form = ThreadListGetForm(request.GET)
     if not form.is_valid():
         raise ValidationError(form.errors)
     return Response(
         get_thread_list(
             request,
             form.cleaned_data["course_id"],
             form.cleaned_data["page"],
             form.cleaned_data["page_size"]
         )
     )
Exemplo n.º 6
0
 def list(self, request):
     """
     Implements the GET method for the list endpoint as described in the
     class docstring.
     """
     form = ThreadListGetForm(request.GET)
     if not form.is_valid():
         raise ValidationError(form.errors)
     return get_thread_list(
         request,
         form.cleaned_data["course_id"],
         form.cleaned_data["page"],
         form.cleaned_data["page_size"],
         form.cleaned_data["topic_id"],
         form.cleaned_data["text_search"],
         form.cleaned_data["following"],
         form.cleaned_data["view"],
         form.cleaned_data["order_by"],
         form.cleaned_data["order_direction"],
     )