Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
Django forms for quiz app ( how to disable a form after submission )

I am creating a classroom app. Which has a exam section where students can give test. If a student wants to give a exam he/she has to select subject and then has to go in exam section. I want student to have access to exam form for one time.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

One possibility to do this is as follows. Note that there are many more options available to you, which one is the easiest depends on your entire application.

Keep track of your students' exam results:

class ExamResult(Model):
    student = ForeignKey(User, related_name='exam_results')
    exam = ForeignKey(Exam, related_name='exam_results')
    ...

In your form template, check whether the student has already an ExamResult object associated with the exam. You could do this in two parts:

In your context builder, define a variable with all the new exams.

exams_taken = ExamResult.objects.filter(student=user).values_list('exam_id', flat=True)
new_exams = Exam.objects.exclude(id__in=exams_taken)

In your form, loop over the new_exams only.

{% for exam in new_exams %}
    {# show the form for this exam #}
{% endfor %}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda