Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

224
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda