Overview
An academic project built with Django, SQLite, and Bootstrap. Teachers and students can generate quizzes on a topic, take them, and track attempts.
Quiz generation tries Google Gemini first, falls back to OpenAI, and finally to a rule-based generator — so the feature degrades gracefully when an AI service is unavailable.
The problem
Writing good quiz questions takes time. Quiz Hub is an academic project that explores whether AI services can take on the first draft — generating quizzes on a topic — while a Django application handles the parts that need to be reliable: accounts, roles, quiz attempts, and dashboards.
At a glance
- Custom user model with student, teacher & admin roles
- Role-based access via decorator and middleware
- AI quiz generation with a three-step fallback
- Structured JSON quiz output
- Quiz attempts tracked per user
- Role-specific dashboards
Quiz generation flow
Each step only runs if the previous one fails.
5 layers · select a layer for details
-
Request Topic, difficulty & question types
A quiz request is submitted to the generation endpoint.
- Django
-
Primary Google Gemini
First choice for generating questions.
- Gemini API
-
Fallback OpenAI
Used if Gemini is unavailable.
- OpenAI API
-
Last resort Rule-based generator
Produces a basic quiz when no AI service responds.
-
Output Structured quiz JSON
Parsed into questions, points, and metadata for rendering or storage.
Roles and access
The application uses a custom user model with three roles — student, teacher, and admin — with separate registration flows for students and teachers. Role-based access is enforced by a custom decorator and middleware, and the admin dashboard is restricted to administrators.
AI-assisted quiz generation
A quiz request specifies a topic, the number of questions, a difficulty level, question types, and optional source content. Generation follows a fallback chain:
- Google Gemini is tried first.
- If that fails, the request falls back to OpenAI.
- If neither service is available, a rule-based generator produces a basic quiz, so the feature degrades instead of breaking.
The AI response is parsed into a structured JSON quiz — title, description, questions, and total points — that the application can render or store.
Taking quizzes
Quizzes and user attempts are stored as separate models, so each attempt and its score can be tracked per user and surfaced in role-specific dashboards.
Limitations
- AI output needs review. Generated questions can be inaccurate or ambiguous; in real use a teacher should review them before students see them.
- External dependencies. Quality depends on the AI services' availability and behaviour — the fallback chain limits, but doesn't remove, that dependency.
- Development setup. The project uses SQLite as its default development database.