A modern, responsive polling application built with Django 5.2, featuring a beautiful UI with full CRUD functionality for creating, voting, and managing polls.
- Create Polls - Create new polls with 2-4 choice options
- Vote in Polls - Simple, intuitive voting interface
- View Results - Real-time results with animated charts and statistics
- Update Polls - Edit poll questions and choice options
- Delete Polls - Safe deletion with confirmation and data integrity checks
- Landing Page - Modern hero section with features showcase
- Modern Design - Clean, minimalist aesthetic with glass-morphism effects
- Responsive Layout - Mobile-first design that works on all devices
- Background Integration - Beautiful background image throughout the application
- Smooth Animations - Micro-interactions, transitions, and loading states
- Interactive Elements - Enhanced forms, buttons, and navigation
- Accessibility - Semantic HTML5 structure with proper ARIA labels
- Django 5.2 - Latest Django framework with modern features
- Class-Based Views - Follows Django best practices
- Form Validation - Client-side and server-side validation
- Error Handling - User-friendly error messages and feedback
- Test Coverage - Comprehensive tests for all functionality
- Database Integrity - Proper cascading deletes and relationship management
- Backend: Django 5.2
- Frontend: Modern CSS3 with JavaScript (ES6+)
- Database: SQLite3 (development)
- Package Manager: UV
- Python: 3.14+
- Styling: Custom CSS framework with CSS custom properties
- Typography: Inter font family (Google Fonts)
- Python 3.14 or higher
- UV package manager
- Git
-
Clone the repository
git clone <repository-url> cd poll-app
-
Set up environment
# Install dependencies uv sync # Activate virtual environment source .venv/bin/activate
-
Set up database
# Apply migrations python manage.py migrate # Create superuser (optional) python manage.py createsuperuser
-
Start development server
python manage.py runserver
-
Access the application Open your browser and navigate to
http://127.0.0.1:8000/polls/
- Hero Section: Eye-catching introduction to the polling platform
- Features Section: Information about platform capabilities
- Recent Polls: Quick access to latest available polls
- Navigation: Easy access to create new polls
- Click "Create Poll" in the navigation bar
- Fill in the form:
- Question: Enter your poll question (required)
- Choices: Add 2-4 choice options (minimum 2 required)
- Submit: Click "Create Poll" to save
- Navigate to a poll from the home page
- Select your choice: Click on any radio button
- Cast your vote: Click "Cast Your Vote" button
- Confirmation: See success message and navigate to results
- Click "View Results" from poll detail or home page
- See statistics:
- Individual choice vote counts
- Visual progress bars showing percentages
- Total votes and poll metadata
- Additional actions: Edit poll, vote again, or share results
- Click "Edit Poll" from any poll detail/results page
- Modify the form:
- Update question text
- Add/remove/modify choice options
- Save changes: Click "Update Poll" button
- Click "Delete Poll" from any poll detail/results page
- Review confirmation:
- See poll details and vote counts
- Warning about data loss if votes exist
- Confirm deletion: Click "Yes, Delete This Poll" button
- Confirmation: Redirect to home with success message
# Activate virtual environment
source .venv/bin/activate
# Install dependencies
uv sync
# Update dependencies
uv add <package-name># Create migrations
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Reset database (development)
python manage.py flush# Start development server
python manage.py runserver
# Start on different port
python manage.py runserver 8001# Run all tests
python manage.py test
# Run specific test class
python manage.py test polls.tests.QuestionModelTests
# Run with verbose output
python manage.py test --verbosity=2
# Run CRUD tests
python manage.py test polls.tests_crud
# Keep test database
python manage.py test --keepdb# Create new app
python manage.py startapp <app_name>
# Collect static files
python manage.py collectstatic
# Django shell
python manage.py shellpoll-app/
βββ core/ # Django project configuration
β βββ __init__.py
β βββ asgi.py
β βββ settings.py
β βββ urls.py
β βββ wsgi.py
βββ polls/ # Main Django app
β βββ migrations/ # Database migrations
β βββ static/ # Static files
β β βββ polls/
β β βββ css/ # Stylesheets
β β β βββ base.css
β β β βββ components.css
β β β βββ responsive.css
β β βββ js/ # JavaScript files
β β β βββ main.js
β β βββ images/ # Images
β βββ templates/ # HTML templates
β β βββ polls/
β β βββ base.html
β β βββ index.html
β β βββ detail.html
β β βββ results.html
β β βββ question_form.html
β β βββ question_confirm_delete.html
β βββ __init__.py
β βββ admin.py # Django admin configuration
β βββ apps.py # App configuration
β βββ forms.py # Django forms
β βββ models.py # Database models
β βββ tests.py # Original tests
β βββ tests_crud.py # CRUD functionality tests
β βββ urls.py # URL patterns
β βββ views.py # View functions/classes
βββ db.sqlite3 # SQLite database
βββ manage.py # Django management script
βββ pyproject.toml # UV dependencies
βββ uv.lock # Dependency lock file
βββ README.md # This file
- Primary:
#2ecc71(green) - Main actions and highlights - Primary Dark:
#27ae60- Hover states - Secondary:
#34495e(dark blue) - Text and borders - Accent:
#e74c3c(red) - Warnings and delete actions - Background:
#ffffff(white) - Main background
- Font Family: Inter (Google Fonts)
- Font Weights: 300 (light), 400 (normal), 500 (medium), 600 (semibold), 700 (bold)
- Font Sizes: Responsive scale from
0.75remto3rem
- Scale:
0.25rem,0.5rem,1rem,1.5rem,2rem,3rem,4rem - Consistent spacing using CSS custom properties
- Cards: Glass-morphism with backdrop blur
- Buttons: Consistent hover states and transitions
- Forms: Validation states and focus indicators
- Navigation: Mobile-responsive with hamburger menu
- Unit Tests: Model methods and business logic
- View Tests: All CRUD operations and edge cases
- Integration Tests: Form submission and user workflows
- Template Tests: UI rendering and response content
# All tests
python manage.py test
# Specific test class
python manage.py test polls.tests.QuestionModelTests
# Specific test method
python manage.py test polls.tests.QuestionModelTests.test_was_published_recently_with_future_question
# Coverage
coverage run --source='.' manage.py test
coverage report- β Model Operations: CRUD, validation, relationships
- β View Rendering: Templates, status codes, context data
- β Form Processing: Valid/invalid data, edge cases
- β URL Routing: Correct view mapping, parameters
- β User Workflows: Complete create β vote β results β update/delete flows
# For production deployment
export DEBUG=False
export SECRET_KEY='your-secret-key-here'
export DATABASE_URL='sqlite:///path/to/production.db'- Debug Mode: Enabled for development
- Static Files: Configured for production serving
- Database: SQLite with proper migration support
- Security: CSRF protection and secure defaults
- Messages: User feedback system enabled
-
Environment Configuration
# Set production environment export DEBUG=False export ALLOWED_HOSTS=['yourdomain.com'] export SECRET_KEY='your-secure-secret-key'
-
Database Setup
# Apply all migrations python manage.py migrate # Collect static files python manage.py collectstatic --noinput
-
Server Configuration
# Using Gunicorn (recommended) pip install gunicorn gunicorn core.wsgi:application --bind 0.0.0.0:8000 # Using Docker docker build -t polls-app . docker run -p 8000:8000 polls-app
- Static Files: Use CDN or cloud storage in production
- Database: PostgreSQL/MySQL for high-traffic applications
- Caching: Implement Redis or Memcached for performance
- Load Balancing: Nginx + multiple Gunicorn instances
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Python: Follow PEP 8 and Django conventions
- CSS: Use BEM methodology, maintain responsive design
- JavaScript: ES6+ features, modular structure
- Templates: Follow Django template best practices
- File Headers: Include script name, description, and author
<type>(<scope>): <subject>
<body>
<footer>
Types: feat, fix, docs, style, refactor, test, chore
- Bug Reports: Use GitHub Issues with detailed steps
- Feature Requests: Include use cases and acceptance criteria
- Security Issues: Report privately to maintainers
This project is licensed under the MIT License - see the LICENSE file for details.
- Django team for the excellent framework
- Google Fonts for the Inter typeface
- Background image contributor (check
polls/static/polls/images/) - Open source community for inspiration and tools
For questions, support, or contributions:
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
Built with β€οΈ using Django and modern web technologies