Skip to content

A Survey application using Django framework where users participate in surveys created by admins. Admin can track the survey submissions with chart based visualizations.

Notifications You must be signed in to change notification settings

chethanMysore/django-survey-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-survey-app

This is a sample survey application built on django-admin following the Django quick start tutorial. This is a SPA built using django-framework where users can participate in surveys created by the administrator of the application. Each user participation is tracked by the administrator and is provided with visualizations on choice distributions for each question in the application. The administration dashboard is an extension of admin templates available in django-admin.

Use admin/admin as credentials to login to admin page.

Features:

  • The polls application is extended to a survey where admin can create multiple surveys with multiple questions and choices for each question.
  • The dashboard is enriched with a statistics widget. The widget displays the popular survey among the surveys and the bar chart visualization of vote distributions among different choices for a question.
  • The application is a SPA with 5 Views on the Users App and a dashboard for the administrator. Partial Views are implemented with a custom middleware view 'index' which further routes URL requests.
  • Created two REST endpoints and used them from admin through AJAX calls.

Installation and Launching the application

Requirements:

  • python version > 3.6 installed
  • django version > 3.1.5 installed
python -m pip install django
  • nested-admin > 3.3.3 installed
pip install django-nested-admin 

or

python -m pip install django-nested-admin 

Run

Check for possible schema changes while using the version control as well as for the first run.

Navigate to the project directory (where manage.py is located) and run

python manage.py makemigrations survey

Create schema for models incorporated in survey app. (The sql script returned can be used shared across teams)

python manage.py sqlmigrate survey 0001

Commit all changes to the databases. This also creates necessary tables in the database.

python manage.py migrate

Collect all static assets and add to build/root folder in main application scope

python manage.py collectstatic

Create an admin user for the application

python manage.py createsuperuser

Run the development server

python manage.py runserver
  • Suggestion: Run this with sudo(linux) and as administrator in windows so that the changes reflect at real time.
  • After running the above command, the survey application will be available at http://localhost:8000/survey and the admin portal can be accessed at http://localhost:8000/admin

User Guide

Checkout this User Guide for quick start

Resources Used

Additional files added and overrided templates from django-admin

  • static/*: the folder consists of static assets used by the application like JS, CSS, Images. static/JS also includes a custom Javascript file, survey_admin.js. the file contains logic to create charts and make AJAX calls to get nested survey entities. static/CSS includes survey-app.css and survey-stats.css to include custom css for widgets and changing overview of the admin portal.
  • templates/admin/*: the folder consists of overrided templates created as a copy from django-admin. This includes admin/base.html, admin/base_site.html and admin/index.html.

Results:

About Page

Gives a brief description of the goals and features of the application About-Page

Surveys List

Lists all surveys created by admin Survey-list

Survey Form

Simple bootstrap4 form for survey Survey-Form

Survey Submit Success

A success page after succesfully submitting the survey Thank-You-Page

Admin Login

Login page for admin Admin-Login

Admin Dashboard

Dashboard for admin to manage surveys Admin-Dashboard

Survey Creation

Create survey with cascaded questions and choices Create-Survey

Survey Statistics

A widget to display survey statistics Survey-Stats

About

A Survey application using Django framework where users participate in surveys created by admins. Admin can track the survey submissions with chart based visualizations.

Topics

Resources

Stars

Watchers

Forks