We can swap the order of the answers every time a quiz game is started [closed]

I want the answers ({{q.op1}},{{q.op2}},{{q.op3}},{{q.op4}}) are not always in the same place but are mixed. For example once : ({{q.op4}},{{q.op3}},{{q.op1}},{{q.op2}}) and the next question again different. How can I do that?

 {% for q in questions %}
                {% if q.kategorie == category and q.flaag == True %}
                        {% if questions.has_next %}
                            <div class="flex-container">
                                <div class="container1">
                                    <div class="game_options_top">
                                        <div class="option">
                                            <p><button class="option_btn"  name="next"  value="{{q.op1}}" formaction="{% url 'quiz' %}?page={{ questions.next_page_number  }} "  type="submit">A: <span id="option_span">{{q.op1}}</span></button></p>
                                        <div class="option">
                                            <p><button class="option_btn"  name="next"  value="{{q.op2}}" formaction="{% url 'quiz' %}?page={{ questions.next_page_number  }} "  type="submit">B: <span id="option_span">{{q.op2}}</span></button></p>
                                    <div class="game_question">
                                        <h1 class="display_question">{{q.question}}</h1>
                                    <div class="game_options_bottom">
                                        <div class="option">
                                            <p><button class="option_btn"  name="next"  value="{{q.op3}}" formaction="{% url 'quiz' %}?page={{ questions.next_page_number  }} "  type="submit">C: <span id="option_span">{{q.op3}}</span></button></p>
                                        <div class="option">
                                            <p><button class="option_btn"  name="next"  value="{{q.op4}}" formaction="{% url 'quiz' %}?page={{ questions.next_page_number  }} "  type="submit">D: <span id="option_span">{{q.op4}}</span></button></p>

question = models.CharField(max_length=200, null=True,)
    op1 = models.CharField(max_length=200, null=True)
    op2 = models.CharField(max_length=200, null=True)
    op3 = models.CharField(max_length=200, null=True)
    op4 = models.CharField(max_length=200, null=True)
    ans = models.CharField(max_length=200, null=True)
    flaag = models.BooleanField('Aprroved', default=False)

    if first == True and request.POST.get("Categorie") != "categorie":

        score = 0
        wrong = 0
        correct = 0
        total = 0
        globalCategory = request.POST.get("Categorie")
        first= False
        count_of_selected_category = Paginator(QuesModel.objects.filter(kategorie__exact=globalCategory), 1)
        page = request.GET.get("page")
        x = count_of_selected_category.get_page(page)
        global_counter = 1
        questions = x

        globalQuestions = questions
        global_count_of_questions = len(QuesModel.objects.filter(categorie__exact=globalCategory, flaag__exact=True))

        context = {
                'questions': globalQuestions,
                'category': request.POST.get("Categorie"),


        return render(request, 'quiz.html', context)

maybea someone have a hint

Back to Top