Quiz Creator App With Django

An application that would let you create, edit and attempt quizzes (intended for tech quizzes), along with keeping a profile. .Here’s a breakdown of the project:

I used designs from the previous blog project(Bad at UI)
  1. quiz: For handling quizzes.
  1. Quizzer: Stores quiz’s title, author (Foreign Key to User), private(For keeping quizzes unpublished), Reattempt( Boolean value for allowing multiple attempts), bg_pic (background picture for quiz modal, stored in the cloud with Cloudinary field), tags (Used taggit for creating a taggable object). Questions of the quiz, number of attempters, tags are retrieved using class methods.
  2. Questions: Stores question text, options(limited to 4), points(for particular question), answer( created a custom RangeField for limiting values to 4) and obviously a foreign key to Quizzer model, quizz.
  3. QuizScore: Stores user’s(Foreign Key to User) score(Integer Field) of the quiz(Foreign Key to Quizzer).
  4. AnonymousUsersData: stores user’s name, the score for quizzes attempted by shareable quizzes.
  1. QuestionsFormset: A formset for taking multiple Questions model inputs.
  2. UserRegsitrationForm: Form for registering users, used built-in UserCreationForm.
  3. UserUpdateForm: Form for updating user’s data (name and address).
  4. ProfileUpdateForm: Form for updating user’s profile (bio and pic).
  1. /register/ : Registration Page.
  2. /login/ : Login Page.
  3. /profile/ : Logged In user’s profile.
  4. /profile/<str:view_user>/ : For viewing other‘s profile.
  5. /quiz/add/ : Adding quizzes.
  6. /quiz/edit/<str:quiz_tit>/ : For editing quiz.
  7. /quiz/shared/<slug:username>/<slug:quiz_name>/<str:id>/ : Url pattern for shared quizzes.
  8. /quiz/<str:slug>/ : Page for attempting quiz.
  9. /api-auth/: Api Views for all the pages.
  1. add_quiz_form: Adds quizzes via QuizForm and QuestionsFormset, at least one is required, needs the user to be logged in.
  2. edit_quiz_form: formsets are used for editing the quizzes, allows authors to edit quizzes by their title.
  3. QuizzView: allows attempting public quizzes by the users, redirects if reattempts are not allowed or quiz doesnot exists, and updates or adds the score of the quiz to the user’s profile data.
  4. Quizzes: Lists the quizzes which are public by other users, and are not yet attempted by the user. Search feature is available
  5. register: Register users with built-in registration form. Signals are used to create profiles of the registered users.
  6. profile: Allows users to update their name, bio, pic and created quizzes, including private and public quizzes with a share option. Lists all the user’s public and attempted quizzes with their score.
Data generated with factoryboy (just random words)

Posting Django Tutorials with Beginner to Advanced Projects