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.
- 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.
- 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
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
python manage.py migrate
python manage.py collectstatic
python manage.py createsuperuser
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
Checkout this User Guide for quick start
- django
- nested-admin
- python
- JQuery
- Bootstrap4
- chart.js
- 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.
Gives a brief description of the goals and features of the application
Lists all surveys created by admin
Simple bootstrap4 form for survey
A success page after succesfully submitting the survey
Dashboard for admin to manage surveys