I am a beginner in Django as well as Python.
I first generate 50 random numbers and store them in a list and then in a text field in model User.
def generate(request, user_id):
    easy = [] * 55
    cnt = 0
    while cnt < 50:
        random_id = random.randint(1, 200)
        if random_id not in easy:
            easy.append(random_id)
            cnt += 1
    current_user = User.objects.get(pk=user_id)
    current_user.question_array = json.dumps(easy)
    return render(request, 'comp/question.html', {'easy': easy[0], 'question_id': 1,'user_id':user_id})
But when I try to retrieve the value from field I get only 0.
When I try to use it as a list it shows an error of "int object cannot be subscript".
This is the code to retrieve it:
def next(request,user_id, question_id):
    current_user = User.objects.get(pk=user_id)
    jsonDec = json.decoder.JSONDecoder()
    easy = jsonDec.decode(current_user.question_array)
    return render(request, 'comp/question.html',
                  {'easy': easy, 'question_id': int(question_id) + 1,'user_id':user_id})
I have used the answer to this question given by mindthief to store a list in a table.
Edit:
My main problem is that the list is not getting stored in database. Any ideas why?