Skip to content

Irsathz/pollster_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Voting Web Application using Django Framework

Introduction

Pollster is a web application built using Django framework. It facilitates conducting polls consisting of questions and choices, allowing users to vote for their preferred choices. The application also provides result visualization for users to track the total votes for specific questions.

Implementation

Creating the Project

  1. Setting Up the Environment:

    • Create an empty folder named pollster_project.
    • Set up a virtual environment using pipenv.
    • Install Django within the virtual environment.
  2. Initializing Django Project:

    • Create a Django project named pollster.
    • Create an app named polls within the project.

Creating Models

  1. Define Models:

    • Define two models, Question and Choice, in the models.py file.
    • Question contains fields for question text and publication date.
    • Choice contains fields for choice text, votes, and a foreign key relationship with Question.
  2. Register Apps:

    • Include the polls app in the INSTALLED_APPS list in settings.py.
  3. Migrations and Database Setup:

    • Generate and apply migrations to create database tables for models.

Creating Admin Interface

  1. Create Superuser:

    • Create a superuser to access the admin panel.
  2. Customize Admin Interface:

    • Customize admin site header, title, and index title.
    • Register models and inline choices for administration.

Creating Views

  1. Define Views:

    • Implement views for displaying questions, voting, viewing details, and displaying results.
    • Utilize Django's built-in render function for rendering templates.
  2. Define URLs:

    • Define URL patterns for views in the urls.py file within the polls app.

Creating Templates

  1. Frontend Layout:

    • Create base HTML layout including navigation bar.
    • Create templates for index, detail, and results pages.
  2. Configure Template Path:

    • Configure the template directory path in Django settings.

Creating Landing Page

  1. Create Pages App:

    • Create a separate app named pages for the landing page.
  2. Define Landing Page View and Template:

    • Implement a view to render the landing page.
    • Create an HTML template for the landing page.

Main URLs Configuration

  1. Configure URLs:
    • Define URL patterns for both polls and pages apps in the main urls.py.

Testing

Admin Frontend

  1. Admin Login:

    • Access the admin panel using the provided URL.
    • Log in using superuser credentials.
  2. Add Questions:

    • Add questions and choices via the admin interface.

User Frontend

  1. Access Landing Page:

    • Visit the landing page of the application.
    • Navigate to available polls.
  2. Voting Process:

    • Select a question and vote for a choice.
    • View the voting results.

Future Scope

This project can serve as a foundation for implementing online voting systems in various domains. Future enhancements could include additional features based on specific requirements, such as user authentication, result analysis, and sharing options.


You can copy this structure into a Markdown file named README.md in your GitHub repository to provide comprehensive documentation for your project. Make sure to replace placeholders with actual content as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published