├── README.md ├── db.sqlite3 ├── manage.py ├── pages ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── urls.cpython-37.pyc │ ├── urls.cpython-39.pyc │ ├── views.cpython-37.pyc │ └── views.cpython-39.pyc ├── admin.py ├── apps.py ├── models.py ├── tests.py ├── urls.py └── views.py ├── polls ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── admin.cpython-37.pyc │ ├── admin.cpython-39.pyc │ ├── apps.cpython-37.pyc │ ├── apps.cpython-39.pyc │ ├── models.cpython-37.pyc │ ├── models.cpython-39.pyc │ ├── urls.cpython-37.pyc │ ├── urls.cpython-39.pyc │ ├── views.cpython-37.pyc │ └── views.cpython-39.pyc ├── admin.py ├── apps.py ├── migrations │ ├── 0001_initial.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-37.pyc │ │ └── __init__.cpython-37.pyc ├── models.py ├── tests.py ├── urls.py └── views.py ├── pollster ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── settings.cpython-37.pyc │ ├── settings.cpython-39.pyc │ ├── urls.cpython-37.pyc │ ├── urls.cpython-39.pyc │ ├── wsgi.cpython-37.pyc │ └── wsgi.cpython-39.pyc ├── settings.py ├── urls.py └── wsgi.py └── templates ├── base.html ├── pages └── index.html ├── partials └── _navbar.html └── polls ├── detail.html ├── index.html └── results.html /README.md: -------------------------------------------------------------------------------- 1 | # PollPlot-Django 2 | A Django Poll and Plot Application 3 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/db.sqlite3 -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pollster.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /pages/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pages/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /pages/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pages/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /pages/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pages/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /pages/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pages/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /pages/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pages/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /pages/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /pages/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PagesConfig(AppConfig): 5 | name = 'pages' 6 | -------------------------------------------------------------------------------- /pages/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /pages/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /pages/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | path('', views.index, name='index'), 7 | ] 8 | -------------------------------------------------------------------------------- /pages/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | def index(request): 4 | return render(request, 'pages/index.html') 5 | -------------------------------------------------------------------------------- /polls/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /polls/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /polls/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /polls/__pycache__/apps.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/apps.cpython-37.pyc -------------------------------------------------------------------------------- /polls/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /polls/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /polls/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /polls/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /polls/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /polls/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /polls/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /polls/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Question, Choice 4 | 5 | admin.site.site_header = "Pollster Admin" 6 | admin.site.site_title = "Pollster Admin Area" 7 | admin.site.index_title = "Welcome to the Pollster admin area" 8 | 9 | 10 | class ChoiceInline(admin.TabularInline): 11 | model = Choice 12 | extra = 3 13 | 14 | 15 | class QuestionAdmin(admin.ModelAdmin): 16 | fieldsets = [(None, {'fields': ['question_text']}), 17 | ('Date Information', {'fields': ['pub_date'], 'classes': ['collapse']}), ] 18 | inlines = [ChoiceInline] 19 | 20 | 21 | # admin.site.register(Question) 22 | # admin.site.register(Choice) 23 | admin.site.register(Question, QuestionAdmin) -------------------------------------------------------------------------------- /polls/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PollsConfig(AppConfig): 5 | name = 'polls' 6 | -------------------------------------------------------------------------------- /polls/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.5 on 2019-09-04 12:31 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Question', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('question_text', models.CharField(max_length=200)), 20 | ('pub_date', models.DateTimeField(verbose_name='date published')), 21 | ], 22 | ), 23 | migrations.CreateModel( 24 | name='Choice', 25 | fields=[ 26 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 27 | ('choice_text', models.CharField(max_length=200)), 28 | ('votes', models.IntegerField(default=0)), 29 | ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Question')), 30 | ], 31 | ), 32 | ] 33 | -------------------------------------------------------------------------------- /polls/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /polls/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/polls/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /polls/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Question(models.Model): 5 | question_text = models.CharField(max_length=200) 6 | pub_date = models.DateTimeField('date published') 7 | 8 | def __str__(self): 9 | return self.question_text 10 | 11 | 12 | class Choice(models.Model): 13 | question = models.ForeignKey(Question, on_delete=models.CASCADE) 14 | choice_text = models.CharField(max_length=200) 15 | votes = models.IntegerField(default=0) 16 | 17 | def __str__(self): 18 | return self.choice_text 19 | -------------------------------------------------------------------------------- /polls/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /polls/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from . import views 4 | 5 | app_name = 'polls' 6 | urlpatterns = [ 7 | path('', views.index, name='index'), 8 | path('/', views.detail, name='detail'), 9 | path('/results/', views.results, name='results'), 10 | path('/vote/', views.vote, name='vote'), 11 | path('resultsdata//', views.resultsData, name="resultsdata"), 12 | ] -------------------------------------------------------------------------------- /polls/views.py: -------------------------------------------------------------------------------- 1 | from django.template import loader 2 | from django.http import HttpResponse, HttpResponseRedirect 3 | from django.shortcuts import get_object_or_404, render 4 | from django.urls import reverse 5 | from django.http import JsonResponse 6 | 7 | from .models import Question, Choice 8 | 9 | # Get questions and display them 10 | def index(request): 11 | latest_question_list = Question.objects.order_by('-pub_date')[:5] 12 | context = {'latest_question_list': latest_question_list} 13 | return render(request, 'polls/index.html', context) 14 | 15 | # Show specific question and choices 16 | def detail(request, question_id): 17 | try: 18 | question = Question.objects.get(pk=question_id) 19 | except Question.DoesNotExist: 20 | raise Http404("Question does not exist") 21 | return render(request, 'polls/detail.html', { 'question': question }) 22 | 23 | # Get question and display results 24 | def results(request, question_id): 25 | question = get_object_or_404(Question, pk=question_id) 26 | return render(request, 'polls/results.html', { 'question': question }) 27 | 28 | # Vote for a question choice 29 | def vote(request, question_id): 30 | # print(request.POST['choice']) 31 | question = get_object_or_404(Question, pk=question_id) 32 | try: 33 | selected_choice = question.choice_set.get(pk=request.POST['choice']) 34 | except (KeyError, Choice.DoesNotExist): 35 | # Redisplay the question voting form. 36 | return render(request, 'polls/detail.html', { 37 | 'question': question, 38 | 'error_message': "You didn't select a choice.", 39 | }) 40 | else: 41 | selected_choice.votes += 1 42 | selected_choice.save() 43 | # Always return an HttpResponseRedirect after successfully dealing 44 | # with POST data. This prevents data from being posted twice if a 45 | # user hits the Back button. 46 | return HttpResponseRedirect(reverse('polls:results', args=(question.id,))) 47 | 48 | def resultsData(request, obj): 49 | votedata = [] 50 | 51 | question = Question.objects.get(id=obj) 52 | votes = question.choice_set.all() 53 | 54 | for i in votes: 55 | votedata.append({i.choice_text:i.votes}) 56 | 57 | print(votedata) 58 | return JsonResponse(votedata, safe=False) 59 | 60 | 61 | -------------------------------------------------------------------------------- /pollster/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /pollster/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /pollster/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /pollster/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /pollster/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /pollster/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /pollster/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MainakRepositor/PollPlot/c57c62d726408b2af4fe1b5442b549540d63440e/pollster/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /pollster/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for pollster project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '1^_&3^e5&d&^1r)7q21ku7kif0czi07fiw_1^&ref^k!y#_h-d' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'polls.apps.PollsConfig', 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'pollster.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'pollster.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /pollster/urls.py: -------------------------------------------------------------------------------- 1 | """pollster URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import include, path 18 | 19 | urlpatterns = [ 20 | path('', include('pages.urls')), 21 | path('polls/', include('polls.urls')), 22 | path('admin/', admin.site.urls), 23 | ] 24 | -------------------------------------------------------------------------------- /pollster/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for pollster project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pollster.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | PollPlot {% block title %}{% endblock %} 14 | 15 | 16 | 17 | {% include 'partials/_navbar.html' %} 18 |
19 |
20 |
21 | {% block content %}{% endblock %} 22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /templates/pages/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block content %} 3 | 4 |
5 |
6 |

Welcome To PollPlot

7 |

Plot what you poll, Poll what you plot!

8 | 9 | View Available Polling Options 11 |
12 |
13 | {% endblock %} -------------------------------------------------------------------------------- /templates/partials/_navbar.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /templates/polls/detail.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block content %} 3 | Back To Polls 4 |

{{ question.question_text }}

5 | 6 | {% if error_message %} 7 |

8 | {{ error_message }} 9 |

10 | {% endif %} 11 | 12 |
13 | {% csrf_token %} 14 | {% for choice in question.choice_set.all %} 15 |
16 | 23 | 25 |
26 | {% endfor %} 27 | 28 |
29 | 30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /templates/polls/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block content %} 3 |

Poll Questions

4 |

To add or remove a poll, use the admin page 🌸

5 | {% if latest_question_list %} 6 | {% for question in latest_question_list %} 7 |
8 |
9 |

{{ question.question_text }}

10 | Vote Now 11 | Results 12 |
13 |
14 | {% endfor %} 15 | {% else %} 16 |

No polls available

17 | {% endif %} 18 | {% endblock %} 19 | 20 | -------------------------------------------------------------------------------- /templates/polls/results.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block content %} 3 | 4 | 5 | 6 | 7 |

{{ question.question_text }}

8 | 9 |
    10 | {% for choice in question.choice_set.all %} 11 |
  • 12 | {{ choice.choice_text }} {{ choice.votes }} vote{{ choice.votes | pluralize }} 13 |
  • 14 | {% endfor %} 15 |
16 | 17 |
18 | 19 | 20 | Back To Polls 21 | Vote again? 22 | 23 | 77 | 78 | {% endblock %} 79 | --------------------------------------------------------------------------------