L
L
Leopandro2021-07-08 12:44:32
Django
Leopandro, 2021-07-08 12:44:32

Is additional needed here? Class?

results = cursor.fetchall()
    fetched_result = []
    for result in results:
        fetched_result.append({
            'username': result[0],
            'spent_money': result[1],
            'gems': result[2],
        })
    return fetched_result

is it in the serializers file
whether additional is needed. class for example UserMoneyResult with fields username, spent_money, gems which will be responsible for displaying the result or serializer is this the class responsible for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-07-08
@vabka

If it's easier with a new class, then yes.
At a minimum, it will be easier, because the IDE will be able to tell you what fields are there normally, and it will be possible to type it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question