from django.http import HttpResponse


def list_question_sets(request):
    return HttpResponse('Lol, udachi')

import json
from django.http import HttpResponse
from maps.models import QuestionSet


def list_question_sets(request):
    objects = QuestionSet.objects.all()
    items = []
    for obj in objects:
        items.append({
            'title': obj.title,
            'max_duration': obj.max_duration.seconds,
            'creator': {
                'full_name': obj.creator.get_full_name()
            }
        })
    return HttpResponse(json.dumps(items))

Add API method for question sets list
Add API method for question sets list

+ import json
  from django.http import HttpResponse
+ from maps.models import QuestionSet
  
  
  def list_question_sets(request):
-     return HttpResponse('Lol, udachi')
+     objects = QuestionSet.objects.all()
+     items = []
+     for obj in objects:
+         items.append({
+             'title': obj.title,
+             'max_duration': obj.max_duration.seconds,
+             'creator': {
+                 'full_name': obj.creator.get_full_name()
+             }
+         })
+     return HttpResponse(json.dumps(items))
  
Add API method for question sets list
## Code Before:
from django.http import HttpResponse


def list_question_sets(request):
    return HttpResponse('Lol, udachi')

## Instruction:
Add API method for question sets list
## Code After:
import json
from django.http import HttpResponse
from maps.models import QuestionSet


def list_question_sets(request):
    objects = QuestionSet.objects.all()
    items = []
    for obj in objects:
        items.append({
            'title': obj.title,
            'max_duration': obj.max_duration.seconds,
            'creator': {
                'full_name': obj.creator.get_full_name()
            }
        })
    return HttpResponse(json.dumps(items))
