├── .gitignore ├── polls ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_choice_is_correct.py │ └── 0001_initial.py ├── static │ ├── images │ │ └── favicon.ico │ └── polls │ │ └── style.css ├── apps.py ├── serializers.py ├── admin.py ├── urls.py ├── models.py ├── tests.py ├── test │ └── tests.py ├── views.py └── templates │ └── polls │ ├── detail.html │ ├── index.html │ └── results.html ├── PollApplication ├── __init__.py ├── urls.py ├── asgi.py ├── wsgi.py └── settings.py ├── .idea ├── shelf │ ├── Uncommitted_changes_before_Update_at_6_12_24,_21_49_[Changes]1 │ │ └── shelved.patch │ ├── Uncommitted_changes_before_Update_at_6_12_24__21_49__Changes_.xml │ └── Uncommitted_changes_before_Update_at_6_12_24,_21_49_[Changes] │ │ └── shelved.patch ├── dataSources │ ├── f4ea550c-4b32-4cb2-ade3-b39f6e2c9418 │ │ └── storage_v2 │ │ │ └── _src_ │ │ │ └── schema │ │ │ └── main.uQUzAA.meta │ └── f4ea550c-4b32-4cb2-ade3-b39f6e2c9418.xml ├── vcs.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml ├── misc.xml ├── dataSources.xml ├── dataSources.local.xml ├── PollApplication.iml └── workspace.xml ├── db.sqlite3 ├── readme-images ├── api.png ├── admin.png ├── details.png ├── homepage.png └── results.png ├── main.py ├── manage.py ├── LICENSE ├── tests.py ├── requirements.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.env -------------------------------------------------------------------------------- /polls/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PollApplication/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polls/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.idea/shelf/Uncommitted_changes_before_Update_at_6_12_24,_21_49_[Changes]1/shelved.patch: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/db.sqlite3 -------------------------------------------------------------------------------- /readme-images/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/readme-images/api.png -------------------------------------------------------------------------------- /readme-images/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/readme-images/admin.png -------------------------------------------------------------------------------- /readme-images/details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/readme-images/details.png -------------------------------------------------------------------------------- /readme-images/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/readme-images/homepage.png -------------------------------------------------------------------------------- /readme-images/results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/readme-images/results.png -------------------------------------------------------------------------------- /polls/static/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangsonww/Django-Poll-Application/HEAD/polls/static/images/favicon.ico -------------------------------------------------------------------------------- /.idea/dataSources/f4ea550c-4b32-4cb2-ade3-b39f6e2c9418/storage_v2/_src_/schema/main.uQUzAA.meta: -------------------------------------------------------------------------------- 1 | #n:main 2 | ! [0, 0, null, null, -2147483648, -2147483648] 3 | -------------------------------------------------------------------------------- /polls/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PollsConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'polls' 7 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PollApplication/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import include, path 3 | from django.views.generic.base import RedirectView 4 | 5 | urlpatterns = [ 6 | path("polls/", include("polls.urls")), 7 | path("admin/", admin.site.urls), 8 | path("", RedirectView.as_view(url="polls/")), 9 | ] 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/shelf/Uncommitted_changes_before_Update_at_6_12_24__21_49__Changes_.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /PollApplication/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for PollApplication project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PollApplication.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /PollApplication/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for PollApplication 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/5.0/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', 'PollApplication.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /polls/migrations/0002_choice_is_correct.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 5.0.6 on 2024-06-11 15:01 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('polls', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='choice', 15 | name='is_correct', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /polls/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from .models import Question, Choice 4 | 5 | 6 | class ChoiceSerializer(serializers.ModelSerializer): 7 | class Meta: 8 | model = Choice 9 | fields = ['id', 'choice_text', 'votes', 'is_correct'] 10 | 11 | 12 | class QuestionSerializer(serializers.ModelSerializer): 13 | choices = ChoiceSerializer(many=True, read_only=True) 14 | 15 | class Meta: 16 | model = Question 17 | fields = ['id', 'question_text', 'pub_date', 'choices'] 18 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sqlite.xerial 6 | true 7 | true 8 | $PROJECT_DIR$/PollApplication/settings.py 9 | org.sqlite.JDBC 10 | jdbc:sqlite:$PROJECT_DIR$/db.sqlite3 11 | $ProjectFileDir$ 12 | 13 | 14 | -------------------------------------------------------------------------------- /polls/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Question, Choice 3 | 4 | admin.site.site_header = "Polls Application Administration" 5 | 6 | 7 | class ChoiceInline(admin.TabularInline): 8 | model = Choice 9 | 10 | extra = 3 11 | 12 | 13 | class QuestionAdmin(admin.ModelAdmin): 14 | fieldsets = [ 15 | (None, {'fields': ['question_text']}), 16 | ('Date information', {'fields': ['pub_date']}), 17 | ] 18 | 19 | inlines = [ChoiceInline] 20 | 21 | list_display = ["question_text", "pub_date", "was_published_recently"] 22 | 23 | list_filter = ["pub_date"] 24 | 25 | search_fields = ["question_text"] 26 | 27 | 28 | admin.site.register(Question, QuestionAdmin) 29 | -------------------------------------------------------------------------------- /polls/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path, include 2 | from django.contrib import admin 3 | from rest_framework.routers import DefaultRouter 4 | 5 | from . import views 6 | 7 | admin.site.site_header = "Polls Application Administration" 8 | 9 | router = DefaultRouter() 10 | router.register(r'questions', views.QuestionViewSet) 11 | router.register(r'choices', views.ChoiceViewSet) 12 | 13 | app_name = "polls" 14 | 15 | urlpatterns = [ 16 | path("", views.index, name="index"), 17 | path("/", views.detail, name="detail"), 18 | path("/results/", views.results, name="results"), 19 | path("/vote/", views.vote, name="vote"), 20 | path('api/', include(router.urls)), 21 | ] 22 | -------------------------------------------------------------------------------- /main.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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PollApplication.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /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 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PollApplication.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /.idea/dataSources.local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | " 7 | 8 | 9 | no-auth 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /polls/models.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | from django.db import models 4 | from django.utils import timezone 5 | from django.contrib import admin 6 | 7 | 8 | class Question(models.Model): 9 | question_text = models.CharField(max_length=200) 10 | pub_date = models.DateTimeField("date published") 11 | 12 | def __str__(self): 13 | return self.question_text 14 | 15 | 16 | @admin.display( 17 | boolean=True, 18 | ordering="pub_date", 19 | description="Published recently?", 20 | ) 21 | def was_published_recently(self): 22 | now = timezone.now() 23 | return now - datetime.timedelta(days=1) <= self.pub_date <= now 24 | 25 | 26 | class Choice(models.Model): 27 | question = models.ForeignKey(Question, on_delete=models.CASCADE) 28 | choice_text = models.CharField(max_length=200) 29 | votes = models.IntegerField(default=0) 30 | is_correct = models.BooleanField(default=False) 31 | 32 | 33 | def __str__(self): 34 | return self.choice_text 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Son Nguyen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /polls/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 5.0.6 on 2024-06-10 04:23 2 | 3 | import django.db.models.deletion 4 | from django.db import migrations, models 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.BigAutoField(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.BigAutoField(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/static/polls/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | background-color: #f4f4f4; 4 | color: #333; 5 | } 6 | 7 | form { 8 | width: 500px; 9 | margin: 40px auto; 10 | padding: 30px; 11 | background-color: #f9f9f9; 12 | border: 1px solid #ddd; 13 | border-radius: 8px; 14 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); 15 | } 16 | 17 | fieldset { 18 | border: none; 19 | padding: 0; 20 | } 21 | 22 | legend h1 { 23 | font-size: 1.8em; 24 | font-weight: 600; 25 | color: #333; 26 | margin-bottom: 20px; 27 | } 28 | 29 | label { 30 | display: block; 31 | margin-bottom: 15px; 32 | font-size: 1.1em; 33 | } 34 | 35 | input[type="radio"] { 36 | margin-right: 8px; 37 | } 38 | 39 | input[type="submit"] { 40 | background-color: #007bff; 41 | color: white; 42 | padding: 12px 25px; 43 | text-align: center; 44 | text-decoration: none; 45 | display: inline-block; 46 | font-size: 16px; 47 | border: none; 48 | border-radius: 5px; 49 | cursor: pointer; 50 | transition: background-color 0.3s ease; 51 | } 52 | 53 | input[type="submit"]:hover { 54 | background-color: #0056b3; 55 | } 56 | 57 | .error-message { 58 | color: #dc3545; 59 | font-weight: bold; 60 | margin-top: 10px; 61 | } 62 | 63 | li a { 64 | color: #007bff; 65 | text-decoration: none; 66 | } 67 | 68 | li a:hover { 69 | text-decoration: underline; 70 | } 71 | -------------------------------------------------------------------------------- /.idea/PollApplication.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 31 | 32 | 33 | 35 | -------------------------------------------------------------------------------- /tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase, Client 2 | from django.urls import reverse 3 | from django.utils import timezone 4 | 5 | from .models import Question, Choice 6 | 7 | 8 | class PollsTest(TestCase): 9 | 10 | def setUp(self): 11 | self.client = Client() 12 | self.question = Question.objects.create(question_text="Test Question", pub_date=timezone.now()) 13 | self.choice = Choice.objects.create(question=self.question, choice_text="Test Choice", votes=0) 14 | 15 | 16 | def test_index_view(self): 17 | response = self.client.get(reverse('polls:index')) 18 | self.assertEqual(response.status_code, 200) 19 | self.assertContains(response, "Test Question") 20 | 21 | 22 | def test_detail_view(self): 23 | response = self.client.get(reverse('polls:detail', args=(self.question.id,))) 24 | self.assertEqual(response.status_code, 200) 25 | self.assertContains(response, "Test Question") 26 | 27 | 28 | def test_results_view(self): 29 | response = self.client.get(reverse('polls:results', args=(self.question.id,))) 30 | self.assertEqual(response.status_code, 200) 31 | self.assertContains(response, "Test Question") 32 | 33 | 34 | def test_vote_view(self): 35 | response = self.client.post(reverse('polls:vote', args=(self.question.id,)), {'choice': self.choice.id}) 36 | self.assertEqual(response.status_code, 302) # Check for redirect 37 | self.choice.refresh_from_db() 38 | self.assertEqual(self.choice.votes, 1) 39 | 40 | 41 | def test_question_viewset(self): 42 | response = self.client.get(reverse('question-list')) 43 | self.assertEqual(response.status_code, 200) 44 | self.assertContains(response, "Test Question") 45 | 46 | 47 | def test_choice_viewset(self): 48 | response = self.client.get(reverse('choice-list')) 49 | self.assertEqual(response.status_code, 200) 50 | self.assertContains(response, "Test Choice") 51 | 52 | -------------------------------------------------------------------------------- /polls/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase, Client 2 | from django.urls import reverse 3 | from django.utils import timezone 4 | 5 | from .models import Question, Choice 6 | 7 | 8 | class PollsTest(TestCase): 9 | 10 | def setUp(self): 11 | self.client = Client() 12 | self.question = Question.objects.create(question_text="Test Question", pub_date=timezone.now()) 13 | self.choice = Choice.objects.create(question=self.question, choice_text="Test Choice", votes=0) 14 | 15 | 16 | def test_index_view(self): 17 | response = self.client.get(reverse('polls:index')) 18 | self.assertEqual(response.status_code, 200) 19 | self.assertContains(response, "Test Question") 20 | 21 | 22 | def test_detail_view(self): 23 | response = self.client.get(reverse('polls:detail', args=(self.question.id,))) 24 | self.assertEqual(response.status_code, 200) 25 | self.assertContains(response, "Test Question") 26 | 27 | 28 | def test_results_view(self): 29 | response = self.client.get(reverse('polls:results', args=(self.question.id,))) 30 | self.assertEqual(response.status_code, 200) 31 | self.assertContains(response, "Test Question") 32 | 33 | 34 | def test_vote_view(self): 35 | response = self.client.post(reverse('polls:vote', args=(self.question.id,)), {'choice': self.choice.id}) 36 | self.assertEqual(response.status_code, 302) # Check for redirect 37 | self.choice.refresh_from_db() 38 | self.assertEqual(self.choice.votes, 1) 39 | 40 | 41 | def test_question_viewset(self): 42 | response = self.client.get(reverse('question-list')) 43 | self.assertEqual(response.status_code, 200) 44 | self.assertContains(response, "Test Question") 45 | 46 | 47 | def test_choice_viewset(self): 48 | response = self.client.get(reverse('choice-list')) 49 | self.assertEqual(response.status_code, 200) 50 | self.assertContains(response, "Test Choice") 51 | 52 | -------------------------------------------------------------------------------- /polls/test/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase, Client 2 | from django.urls import reverse 3 | from django.utils import timezone 4 | 5 | from .models import Question, Choice 6 | 7 | 8 | class PollsTest(TestCase): 9 | 10 | def setUp(self): 11 | self.client = Client() 12 | self.question = Question.objects.create(question_text="Test Question", pub_date=timezone.now()) 13 | self.choice = Choice.objects.create(question=self.question, choice_text="Test Choice", votes=0) 14 | 15 | 16 | def test_index_view(self): 17 | response = self.client.get(reverse('polls:index')) 18 | self.assertEqual(response.status_code, 200) 19 | self.assertContains(response, "Test Question") 20 | 21 | 22 | def test_detail_view(self): 23 | response = self.client.get(reverse('polls:detail', args=(self.question.id,))) 24 | self.assertEqual(response.status_code, 200) 25 | self.assertContains(response, "Test Question") 26 | 27 | 28 | def test_results_view(self): 29 | response = self.client.get(reverse('polls:results', args=(self.question.id,))) 30 | self.assertEqual(response.status_code, 200) 31 | self.assertContains(response, "Test Question") 32 | 33 | 34 | def test_vote_view(self): 35 | response = self.client.post(reverse('polls:vote', args=(self.question.id,)), {'choice': self.choice.id}) 36 | self.assertEqual(response.status_code, 302) # Check for redirect 37 | self.choice.refresh_from_db() 38 | self.assertEqual(self.choice.votes, 1) 39 | 40 | 41 | def test_question_viewset(self): 42 | response = self.client.get(reverse('question-list')) 43 | self.assertEqual(response.status_code, 200) 44 | self.assertContains(response, "Test Question") 45 | 46 | 47 | def test_choice_viewset(self): 48 | response = self.client.get(reverse('choice-list')) 49 | self.assertEqual(response.status_code, 200) 50 | self.assertContains(response, "Test Choice") 51 | 52 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | altair 2 | amqp 3 | APScheduler 4 | asgiref 5 | astroid 6 | attrs 7 | autopep8 8 | bcrypt 9 | beautifulsoup4 10 | bidict 11 | billiard 12 | blinker 13 | cachelib 14 | cachetools 15 | celery 16 | certifi 17 | cffi 18 | charset-normalizer 19 | click 20 | click-didyoumean 21 | click-plugins 22 | click-repl 23 | coloredlogs 24 | decorator 25 | django-debug-toolbar 26 | django-redis 27 | django-rest-framework-mongoengine 28 | Django==3.2 29 | djangorestframework==3.12.4 30 | djongo 31 | dnspython 32 | eventlet 33 | filelock 34 | Flask 35 | Flask-Cors 36 | Flask-Session 37 | Flask-SocketIO 38 | flatbuffers 39 | fsspec 40 | gitdb 41 | GitPython 42 | greenlet 43 | gunicorn 44 | h11 45 | huggingface-hub 46 | humanfriendly 47 | idna 48 | imageio 49 | imageio-ffmpeg 50 | isort 51 | itsdangerous 52 | Jinja2 53 | joblib 54 | jsonschema 55 | jsonschema-specifications 56 | kombu 57 | lazy-object-proxy 58 | lazy_loader 59 | llvmlite 60 | markdown-it-py 61 | MarkupSafe 62 | mccabe 63 | mdurl 64 | mongoengine 65 | moviepy 66 | mpmath 67 | mysqlclient 68 | networkx 69 | nltk 70 | numba 71 | numpy 72 | onnxruntime 73 | opencv-python-headless 74 | packaging 75 | pandas 76 | pillow 77 | platformdirs 78 | pooch 79 | proglog 80 | prompt_toolkit 81 | protobuf 82 | psycopg2 83 | psycopg2-binary 84 | pyarrow 85 | pycodestyle 86 | pycparser 87 | pydeck 88 | pygame 89 | Pygments 90 | pylint 91 | PyMatting 92 | pymongo 93 | python-dateutil 94 | python-decouple 95 | python-dotenv 96 | python-engineio 97 | python-socketio 98 | pytz 99 | PyYAML 100 | redis 101 | referencing 102 | regex 103 | rembg 104 | requests 105 | rich 106 | rpds-py 107 | safetensors 108 | scikit-image 109 | scikit-learn 110 | scipy 111 | setuptools 112 | simple-websocket 113 | six 114 | smmap 115 | soupsieve 116 | sqlparse 117 | streamlit 118 | sympy 119 | tenacity 120 | threadpoolctl 121 | tifffile 122 | tokenizers 123 | toml 124 | toolz 125 | torch 126 | torchvision 127 | tornado 128 | tqdm 129 | transformers 130 | typing_extensions 131 | tzdata 132 | tzlocal 133 | urllib3 134 | vine 135 | wcwidth 136 | Werkzeug 137 | wrapt 138 | wsproto 139 | zope.event 140 | zope.interface 141 | -------------------------------------------------------------------------------- /polls/views.py: -------------------------------------------------------------------------------- 1 | from django.template import loader 2 | from django.http import Http404 3 | from django.db.models import F 4 | from django.http import HttpResponse, HttpResponseRedirect 5 | from django.shortcuts import get_object_or_404, render 6 | from django.urls import reverse 7 | 8 | from rest_framework import viewsets, permissions 9 | 10 | from .models import Choice, Question 11 | from .serializers import QuestionSerializer, ChoiceSerializer 12 | 13 | 14 | def index(request): 15 | latest_question_list = Question.objects.order_by("-pub_date")[:5] 16 | template = loader.get_template("polls/index.html") 17 | context = { 18 | "latest_question_list": latest_question_list, 19 | } 20 | return HttpResponse(template.render(context, request)) 21 | 22 | 23 | def detail(request, question_id): 24 | try: 25 | question = Question.objects.get(pk=question_id) 26 | except Question.DoesNotExist: 27 | raise Http404("Question does not exist") 28 | return render(request, "polls/detail.html", {"question": question}) 29 | 30 | 31 | def results(request, question_id): 32 | question = get_object_or_404(Question, pk=question_id) 33 | correct_choice = question.choice_set.filter(is_correct=True).first() 34 | 35 | return render(request, 'polls/results.html', { 36 | 'question': question, 37 | 'correct_choice': correct_choice, 38 | }) 39 | 40 | 41 | def vote(request, question_id): 42 | question = get_object_or_404(Question, pk=question_id) 43 | try: 44 | selected_choice = question.choice_set.get(pk=request.POST["choice"]) 45 | except (KeyError, Choice.DoesNotExist): 46 | return render( 47 | request, 48 | "polls/detail.html", 49 | { 50 | "question": question, 51 | "error_message": "You didn't select a choice.", 52 | }, 53 | ) 54 | else: 55 | selected_choice.votes = F("votes") + 1 56 | selected_choice.save() 57 | # Always return an HttpResponseRedirect after successfully dealing 58 | # with POST data. This prevents data from being posted twice if a 59 | # user hits the Back button. 60 | return HttpResponseRedirect(reverse("polls:results", args=(question.id,))) 61 | 62 | 63 | class QuestionViewSet(viewsets.ModelViewSet): 64 | queryset = Question.objects.all() 65 | serializer_class = QuestionSerializer 66 | # Allow GET for anyone, but POST/PUT/DELETE for authenticated users only 67 | permission_classes = [permissions.IsAuthenticatedOrReadOnly] 68 | 69 | 70 | class ChoiceViewSet(viewsets.ModelViewSet): 71 | queryset = Choice.objects.all() 72 | serializer_class = ChoiceSerializer 73 | permission_classes = [permissions.IsAuthenticatedOrReadOnly] 74 | -------------------------------------------------------------------------------- /PollApplication/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for PollApplication project. 3 | 4 | Generated by 'django-admin startproject' using Django 5.0. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/5.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/5.0/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | from decouple import config 15 | 16 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 17 | BASE_DIR = Path(__file__).resolve().parent.parent 18 | 19 | 20 | # Quick-start development settings - unsuitable for production 21 | # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ 22 | 23 | ALLOWED_HOSTS = ['*'] 24 | 25 | CORS_ALLOWED_ORIGINS = ['*'] 26 | 27 | # SECURITY WARNING: keep the secret key used in production secret! 28 | SECRET_KEY = config('DJANGO_SECRET_KEY') 29 | 30 | # SECURITY WARNING: don't run with debug turned on in production! 31 | DEBUG = False 32 | 33 | # Application definition 34 | 35 | INSTALLED_APPS = [ 36 | "polls.apps.PollsConfig", 37 | "django.contrib.admin", 38 | "django.contrib.auth", 39 | "django.contrib.contenttypes", 40 | "django.contrib.sessions", 41 | "django.contrib.messages", 42 | "django.contrib.staticfiles", 43 | "rest_framework", 44 | ] 45 | 46 | MIDDLEWARE = [ 47 | 'django.middleware.security.SecurityMiddleware', 48 | 'django.contrib.sessions.middleware.SessionMiddleware', 49 | 'django.middleware.common.CommonMiddleware', 50 | 'django.middleware.csrf.CsrfViewMiddleware', 51 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 52 | 'django.contrib.messages.middleware.MessageMiddleware', 53 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 54 | ] 55 | 56 | ROOT_URLCONF = 'PollApplication.urls' 57 | 58 | ADMIN_SITE_HEADER = "Polls Application Administration" 59 | 60 | TEMPLATES = [ 61 | { 62 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 63 | 'DIRS': [], 64 | 'APP_DIRS': True, 65 | 'OPTIONS': { 66 | 'context_processors': [ 67 | 'django.template.context_processors.debug', 68 | 'django.template.context_processors.request', 69 | 'django.contrib.auth.context_processors.auth', 70 | 'django.contrib.messages.context_processors.messages', 71 | ], 72 | }, 73 | }, 74 | ] 75 | 76 | WSGI_APPLICATION = 'PollApplication.wsgi.application' 77 | 78 | 79 | # Database 80 | # https://docs.djangoproject.com/en/5.0/ref/settings/#databases 81 | 82 | DATABASES = { 83 | 'default': { 84 | 'ENGINE': 'django.db.backends.sqlite3', 85 | 'NAME': BASE_DIR / 'db.sqlite3', 86 | } 87 | } 88 | 89 | 90 | # Password validation 91 | # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators 92 | 93 | AUTH_PASSWORD_VALIDATORS = [ 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 99 | }, 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 102 | }, 103 | { 104 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 105 | }, 106 | ] 107 | 108 | 109 | # Internationalization 110 | # https://docs.djangoproject.com/en/5.0/topics/i18n/ 111 | 112 | LANGUAGE_CODE = 'en-us' 113 | 114 | TIME_ZONE = 'UTC' 115 | 116 | USE_I18N = True 117 | 118 | USE_TZ = True 119 | 120 | 121 | # Static files (CSS, JavaScript, Images) 122 | # https://docs.djangoproject.com/en/5.0/howto/static-files/ 123 | 124 | STATIC_URL = 'static/' 125 | 126 | # Default primary key field type 127 | # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field 128 | 129 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 130 | -------------------------------------------------------------------------------- /polls/templates/polls/detail.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | "{{ question.question_text }}" - Poll Details 8 | 9 | 76 | 77 | 78 |
79 |
80 | {% csrf_token %} 81 |
82 |

{{ question.question_text }}

83 | {% if error_message %}

{{ error_message }}

{% endif %} 84 |

Answer Choices:

85 |
    86 | {% for choice in question.choice_set.all %} 87 |
  • 88 | 89 | 90 |
  • 91 | {% endfor %} 92 |
93 | 94 |
95 |
96 | Back to Polls 97 |
98 |
99 |

© 2024 The Django Poll App - By Son Nguyen

100 |
101 | 102 | 103 | -------------------------------------------------------------------------------- /.idea/shelf/Uncommitted_changes_before_Update_at_6_12_24,_21_49_[Changes]/shelved.patch: -------------------------------------------------------------------------------- 1 | Index: PollApplication/settings.py 2 | IDEA additional info: 3 | Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP 4 | <+>\"\"\"\nDjango settings for PollApplication project.\n\nGenerated by 'django-admin startproject' using Django 5.0.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/5.0/topics/settings/\n\nFor the full list of settings and their values, see\nhttps://docs.djangoproject.com/en/5.0/ref/settings/\n\"\"\"\n\nfrom pathlib import Path\n\n# Build paths inside the project like this: BASE_DIR / 'subdir'.\nBASE_DIR = Path(__file__).resolve().parent.parent\n\n\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/\n\n# SECURITY WARNING: keep the secret key used in production secret!\n# SECRET_KEY = 'your_secret_key'\n\n# SECURITY WARNING: don't run with debug turned on in production!\n# DEBUG = True\n\nALLOWED_HOSTS = []\n\n\n# Application definition\n\nINSTALLED_APPS = [\n \"polls.apps.PollsConfig\",\n \"django.contrib.admin\",\n \"django.contrib.auth\",\n \"django.contrib.contenttypes\",\n \"django.contrib.sessions\",\n \"django.contrib.messages\",\n \"django.contrib.staticfiles\",\n \"rest_framework\",\n]\n\nMIDDLEWARE = [\n 'django.middleware.security.SecurityMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.common.CommonMiddleware',\n 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n 'django.middleware.clickjacking.XFrameOptionsMiddleware',\n]\n\nROOT_URLCONF = 'PollApplication.urls'\n\nADMIN_SITE_HEADER = \"Polls Application Administration\"\n\nTEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'DIRS': [],\n 'APP_DIRS': True,\n 'OPTIONS': {\n 'context_processors': [\n 'django.template.context_processors.debug',\n 'django.template.context_processors.request',\n 'django.contrib.auth.context_processors.auth',\n 'django.contrib.messages.context_processors.messages',\n ],\n },\n },\n]\n\nWSGI_APPLICATION = 'PollApplication.wsgi.application'\n\n\n# Database\n# https://docs.djangoproject.com/en/5.0/ref/settings/#databases\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': BASE_DIR / 'db.sqlite3',\n }\n}\n\n\n# Password validation\n# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators\n\nAUTH_PASSWORD_VALIDATORS = [\n {\n 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',\n },\n {\n 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',\n },\n {\n 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',\n },\n {\n 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',\n },\n]\n\n\n# Internationalization\n# https://docs.djangoproject.com/en/5.0/topics/i18n/\n\nLANGUAGE_CODE = 'en-us'\n\nTIME_ZONE = 'UTC'\n\nUSE_I18N = True\n\nUSE_TZ = True\n\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\n\nSTATIC_URL = 'static/'\n\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\n\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'\n 5 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 6 | <+>UTF-8 7 | =================================================================== 8 | diff --git a/PollApplication/settings.py b/PollApplication/settings.py 9 | --- a/PollApplication/settings.py 10 | +++ b/PollApplication/settings.py 11 | @@ -20,10 +20,10 @@ 12 | # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ 13 | 14 | # SECURITY WARNING: keep the secret key used in production secret! 15 | -# SECRET_KEY = 'your_secret_key' 16 | +SECRET_KEY = 'django-insecure-qx14ogui1^h3@h8zl38-8@3t%n8y0r_-anx$26=!pecc#=gx#^' 17 | 18 | # SECURITY WARNING: don't run with debug turned on in production! 19 | -# DEBUG = True 20 | +DEBUG = True 21 | 22 | ALLOWED_HOSTS = [] 23 | 24 | -------------------------------------------------------------------------------- /polls/templates/polls/index.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | The Django Poll App 8 | 9 | 92 | 93 | 94 |
95 |

The Django Poll App

96 |
97 |
98 |
99 | {% if latest_question_list %} 100 |
    101 | {% for question in latest_question_list %} 102 |
  1. {{ question.question_text }}
  2. 103 | {% endfor %} 104 |
105 | {% else %} 106 |

No polls are available.

107 | {% endif %} 108 |
109 |
110 |
111 |

Only logged in admin users can add, edit, or delete polls. Go to the admin page to manage polls.

112 |
113 |
114 |

© 2024 The Django Poll App - By Son Nguyen

115 |
116 | 117 | 118 | -------------------------------------------------------------------------------- /polls/templates/polls/results.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | "{{ question.question_text }}" - Poll Results 8 | 9 | 10 | 88 | 89 | 90 |
91 |

Poll Results for "{{ question.question_text }}"

92 |
93 |
94 |
95 |

Results for "{{ question.question_text }}"

96 |
    97 | {% for choice in question.choice_set.all %} 98 |
  • 99 | {{ choice.choice_text }} - {{ choice.votes }} vote{{ choice.votes|pluralize }} 100 | {% if choice == correct_choice %} 101 | (Correct Answer) 102 | {% endif %} 103 |
  • 104 | {% endfor %} 105 |
106 | 107 | Vote again? 108 |
109 |
110 |
111 |

© 2024 The Django Poll App - By Son Nguyen

112 |
113 | 171 | 172 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Django Poll Application 2 | 3 | This repository hosts a simple, lightweight poll application that was built with Django, designed to showcase fundamental Django concepts like models, views, templates, and the admin interface. 4 | 5 | ## Table of Contents 6 | - [Live Deployment](#live-deployment) 7 | - [User Interface](#user-interface) 8 | - [Features](#features) 9 | - [Technologies Used](#technologies-used) 10 | - [Installation](#installation) 11 | - [Usage](#usage) 12 | - [Project Structure](#project-structure) 13 | - [Customization](#customization) 14 | - [Contributions](#contributions) 15 | - [License](#license) 16 | - [Contact](#contact) 17 | 18 | ## Live Deployment 19 | 20 | You can access the live deployment of this project [here](https://django-poll-application.onrender.com). 21 | 22 | The app is hosted on Render, a cloud platform that offers free hosting for static sites and web services. The deployment is automatically updated whenever changes are pushed to the `master` branch. 23 | 24 | Note: The server may spin down after a period of inactivity, so the initial load time may be longer. It may take up to 2 minutes to load the page if the server is inactive for a while. Please be patient! 25 | 26 | ## User Interface 27 | 28 | ### Homepage 29 | 30 |

31 | User Interface 1 32 |

33 | 34 | ### Poll Details 35 | 36 |

37 | User Interface 2 38 |

39 | 40 | ### Poll Results 41 | 42 |

43 | User Interface 3 44 |

45 | 46 | ### Admin Interface 47 | 48 |

49 | User Interface 4 50 |

51 | 52 | ## Features 53 | 54 | - **Create Polls:** Admin users can easily create questions and add multiple answer choices. 55 | - **Vote:** Users can view available polls and vote for their preferred choices. 56 | - **Results:** Real-time results are displayed after voting, showing the distribution of votes. 57 | - **Admin Dashboard:** A robust admin interface allows for managing questions, choices, and viewing results. 58 | - **Correct Answers:** Admin users can specify correct answers for each question, and users see if they voted correctly on the results page. 59 | - **Homepage and Navigation:** Clear navigation between the homepage (list of polls), poll details, and results. 60 | - **Basic Styling:** Includes basic CSS styles for a clean and visually appealing presentation. 61 | 62 | ## Technologies Used 63 | 64 | - **Django:** Web framework for rapid development. 65 | - **Python:** The programming language used for the backend logic. 66 | - **HTML/CSS:** For structuring and styling the user interface. 67 | - **JavaScript (Optional):** Used for adding interactivity (e.g., Chart.js in your `results.html`). 68 | 69 | ## Installation 70 | 71 | 1. **Clone the Repository:** Clone the repository using the Code button in the repository's main GitHub page. 72 | 73 | 2. **Create a Virtual Environment:** 74 | ```bash 75 | python -m venv .venv 76 | ``` 77 | 78 | 3. **Activate the Virtual Environment:** 79 | ```bash 80 | source .venv/bin/activate # Linux/macOS 81 | .\venv\Scripts\activate # Windows 82 | ``` 83 | 84 | 4. **Run Migrations:** 85 | ```bash 86 | python manage.py makemigrations 87 | python manage.py migrate 88 | ``` 89 | 90 | 5. **Create Admin User:** 91 | ```bash 92 | python manage.py createsuperuser 93 | ``` 94 | 95 | 6. **Start the Server:** 96 | ```bash 97 | python manage.py runserver 98 | ``` 99 | 100 | **Important**: Remember to change the Django production secret key and set `DEBUG` to `True` in `PollApplication/settings.py` order to run the server: 101 | ```python 102 | SECRET_KEY = 'your_secret_key' 103 | 104 | DEBUG = True 105 | ``` 106 | 107 | Also, as you develop the app, every time you make changes to the data in the back end, be sure that you migrate them to the SQLite database using the following commands: 108 | ```bash 109 | python manage.py makemigrations 110 | python manage.py migrate 111 | ``` 112 | 113 | Then start the server again using `python manage.py runserver` and you'll be all set! 114 | 115 | ## Usage 116 | 117 | 1. **Access the Admin Interface:** Go to `http://127.0.0.1:8000/admin/` and log in with your superuser credentials. 118 | 2. **Create Polls:** 119 | - Click "Polls" or "Questions" in the admin interface. 120 | - Click "Add Question" and fill out the question text and publication date. 121 | - Click "Save and continue editing" to add answer choices. 122 | - Mark the correct answer using the checkbox. 123 | 3. **View Polls:** Visit the homepage (`http://127.0.0.1:8000/polls/`) to see the list of available polls. 124 | 4. **Vote:** Click on a poll to view details and select your answer. 125 | 5. **View Results:** After voting, you'll be redirected to the results page, where you can see the vote distribution and whether you answered correctly. 126 | 127 | ## Project Structure 128 | 129 | - **`polls/`:** 130 | - `models.py`: Defines the `Question` and `Choice` models. 131 | - `views.py`: Contains the views for displaying polls, voting, and showing results. 132 | - `admin.py`: Customizes the Django admin for poll management. 133 | - `urls.py`: Defines the URL patterns for the poll app. 134 | - `tests.py`: Contains test cases for the app. 135 | - `__init__.py`: Makes the directory a Python package. 136 | - `apps.py`: Configuration for the app. 137 | - `templates/polls/`: Contains the HTML templates for the app's views. 138 | - `index.html`: Homepage with a list of polls. 139 | - `detail.html`: Poll details and voting form. 140 | - `results.html`: Poll results with vote distribution. 141 | - `static/`: (Optional) Stores static files like CSS for styling. 142 | - `images/`: Contains images used in the app. 143 | - `polls/style.css`: CSS file for styling the app. 144 | - `migrations/`: Contains database migration files. 145 | - **`PollApplication/`:** 146 | - `settings.py`: Contains the project settings and configurations. 147 | - `urls.py`: Defines the URL patterns for the entire project. 148 | - `wsgi.py`: WSGI configuration for deployment. 149 | - `asgi.py`: ASGI configuration for deployment. 150 | - `__init__.py`: Makes the directory a Python package. 151 | - **`db.sqlite3`:** The default SQLite database file. 152 | - **`manage.py`:** A command-line utility for interacting with the project. 153 | 154 | ## Customization 155 | 156 | - **Templates:** Modify the HTML templates (`index.html`, `detail.html`, `results.html`) to customize the look and feel of the poll pages. 157 | - **Styling:** Add more CSS rules to `style.css` or create new stylesheets for further customization. 158 | - **Functionality:** Extend the models or views to add more features like user authentication, poll comments, or social media sharing. 159 | 160 | ## REST API Usage 161 | 162 | This app also includes a REST API built with Django REST Framework (DRF). Here are the available endpoints: 163 | 164 | | Endpoint | Methods | Description | Authentication Required | 165 | |:-----------------------|:----------------------:|:--------------------------------------------|:-----------------------:| 166 | | `/api/questions/` | GET, POST, PUT, DELETE | List/create/update/delete questions. | ✅ | 167 | | `/api/questions//` | GET, PUT, DELETE | Retrieve/update/delete a specific question. | ✅ | 168 | | `/api/choices/` | GET, POST, PUT, DELETE | List/create/update/delete choices. | ✅ | 169 | | `/api/choices//` | GET, PUT, DELETE | Retrieve/update/delete a specific choice. | ✅ | 170 | 171 | **Example Usage (with curl):** 172 | 173 | ```bash 174 | # Get all questions 175 | curl http://127.0.0.1:8000/api/questions/ 176 | 177 | # Get a specific question 178 | curl http://127.0.0.1:8000/api/questions/1/ 179 | ``` 180 | 181 | For example, if you run `curl http://127.0.0.1:8000/api/questions/`, you will get this output: 182 | 183 | ```json 184 | [{"id":3,"question_text":"huhu","pub_date":"2024-06-10T07:21:01Z"},{"id":4,"question_text":"hehehehe","pub_date":"2024-06-11T15:01:59Z"},{"id":5,"question_text":"What is the capital of France?","pub_date":"2024-06-11T15:11:04Z"}] 185 | ``` 186 | 187 | You can also directly visit the API endpoints in your browser: 188 | 189 |

190 | API Interface 191 |

192 | 193 | **Authentication:** 194 | To use POST, PUT, or DELETE methods, you'll need a valid token, typically obtained after user login. Include this token in the Authorization header: 195 | 196 | ```bash 197 | curl -X POST -H "Authorization: Token " -H "Content-Type: application/json" -d '{"question_text": "Is this a new question?", "pub_date": "2023-12-12T12:00:00Z"}' http://127.0.0.1:8000/api/questions/ 198 | ``` 199 | 200 | ## Contributions 201 | 202 | Contributions are welcome! Feel free to open issues or submit pull requests. Feel free to also fork and customize this repo to fit your needs. 203 | 204 | ## License 205 | 206 | This project is licensed under the [MIT License](LICENSE). 207 | 208 | ## Contact 209 | 210 | If you have any questions about this project or Django (or even the Django REST Framework) in general, feel free to [contact me](mailto:info@movie-verse.com)! I'll be happy to answer any questions you might have (hopefully I'll know the answers to them...) 211 | 212 | --- 213 | 214 | Thank you for visiting today! Created with ❤️ in 2024 by [Son Nguyen](https://github.com/hoangsonww). 215 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 41 | 42 | 43 | 45 | { 46 | "lastFilter": { 47 | "state": "OPEN", 48 | "assignee": "hoangsonww" 49 | } 50 | } 51 | { 52 | "selectedUrlAndAccountId": { 53 | "url": "https://github.com/hoangsonww/Django-Poll-Application.git", 54 | "accountId": "96738bbf-61cc-45b7-a456-2974fb587c71" 55 | } 56 | } 57 | { 58 | "associatedIndex": 2 59 | } 60 | 61 | 62 | 63 | 64 | 65 | 68 | { 69 | "keyToString": { 70 | "ASKED_ADD_EXTERNAL_FILES": "true", 71 | "DefaultHtmlFileTemplate": "HTML File", 72 | "Django Server.PollApplication.executor": "Run", 73 | "Django tests.Test: polls.tests.PollsTest.executor": "Run", 74 | "Django tests.Test: polls.tests.PollsTest.test_question_viewset.executor": "Run", 75 | "Python.python manage.py makemigrations.executor": "Run", 76 | "RunOnceActivity.OpenDjangoStructureViewOnStart": "true", 77 | "RunOnceActivity.ShowReadmeOnStart": "true", 78 | "RunOnceActivity.pycharm.django.structure.promotion.once.per.project": "true", 79 | "SHARE_PROJECT_CONFIGURATION_FILES": "true", 80 | "django.template.preview.state": "SHOW_EDITOR_AND_PREVIEW", 81 | "git-widget-placeholder": "master", 82 | "last_opened_file_path": "/Users/davidnguyen/PycharmProjects/PollApplication", 83 | "node.js.detected.package.eslint": "true", 84 | "node.js.detected.package.tslint": "true", 85 | "node.js.selected.package.eslint": "(autodetect)", 86 | "node.js.selected.package.tslint": "(autodetect)", 87 | "nodejs_package_manager_path": "npm", 88 | "settings.editor.selected.configurable": "vcs.Git", 89 | "vue.rearranger.settings.migration": "true" 90 | } 91 | } 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 126 | 127 | 128 | 147 | 148 | 149 | 170 | 171 | 172 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 1717992802768 215 | 239 | 240 | 247 | 248 | 255 | 256 | 263 | 264 | 271 | 272 | 279 | 280 | 287 | 288 | 295 | 296 | 303 | 304 | 311 | 312 | 319 | 320 | 327 | 328 | 335 | 336 | 343 | 344 | 351 | 354 | 355 | 357 | 358 | 367 | 368 | 369 | 374 | 375 | 376 | 377 | 378 | 379 | -------------------------------------------------------------------------------- /.idea/dataSources/f4ea550c-4b32-4cb2-ade3-b39f6e2c9418.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 3.45.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 1 23 | 24 | 25 | 1 26 | 27 | 28 | 1 29 | 30 | 31 | 1 32 | 33 | 34 | 1 35 | 36 | 37 | 1 38 | 39 | 40 | 1 41 | 42 | 43 | 1 44 | 45 | 46 | 1 47 | 48 | 49 | 1 50 | 51 | 52 | 53 | window 54 | 55 | 56 | 1 57 | 58 | 59 | 1 60 | 61 | 62 | 1 63 | 64 | 65 | 66 | 1 67 | 1 68 | 69 | 70 | 71 | 72 | 1 73 | 1 74 | 75 | 76 | 1 77 | 1 78 | 79 | 80 | 1 81 | 1 82 | 83 | 84 | 1 85 | 86 | 87 | 1 88 | 89 | 90 | 91 | 92 | window 93 | 94 | 95 | window 96 | 97 | 98 | 99 | 100 | 101 | 1 102 | 1 103 | 104 | 105 | 1 106 | 1 107 | 108 | 109 | 1 110 | 111 | 112 | window 113 | 114 | 115 | 116 | 1 117 | 118 | 119 | window 120 | 121 | 122 | 1 123 | 124 | 125 | 1 126 | 1 127 | 128 | 129 | 130 | 131 | 132 | 1 133 | 134 | 135 | 1 136 | 137 | 138 | window 139 | 140 | 141 | 1 142 | 143 | 144 | 1 145 | 146 | 147 | 1 148 | 149 | 150 | 1 151 | 152 | 153 | 1 154 | 155 | 156 | 1 157 | 158 | 159 | 1 160 | 1 161 | 162 | 163 | 1 164 | 165 | 166 | 1 167 | 168 | 169 | 1 170 | 1 171 | 172 | 173 | 1 174 | window 175 | 176 | 177 | 1 178 | window 179 | 180 | 181 | 1 182 | 1 183 | 184 | 185 | 1 186 | 1 187 | 188 | 189 | 1 190 | 191 | 192 | 1 193 | 194 | 195 | 1 196 | 1 197 | 198 | 199 | 1 200 | 1 201 | 202 | 203 | 1 204 | 1 205 | 206 | 207 | 1 208 | 209 | 210 | 1 211 | 212 | 213 | 1 214 | 215 | 216 | 1 217 | 1 218 | 219 | 220 | 1 221 | 1 222 | 223 | 224 | 1 225 | window 226 | 227 | 228 | 1 229 | window 230 | 231 | 232 | 1 233 | 1 234 | 235 | 236 | 1 237 | 1 238 | 239 | 240 | 1 241 | 242 | 243 | 1 244 | 1 245 | 246 | 247 | 1 248 | 1 249 | 250 | 251 | 1 252 | 1 253 | 254 | 255 | 1 256 | 1 257 | 258 | 259 | window 260 | 261 | 262 | window 263 | 264 | 265 | 266 | window 267 | 268 | 269 | window 270 | 271 | 272 | window 273 | 274 | 275 | 276 | 1 277 | 278 | 279 | 1 280 | 281 | 282 | 1 283 | 284 | 285 | 1 286 | 287 | 288 | 1 289 | 290 | 291 | 292 | 1 293 | 294 | 295 | 1 296 | 297 | 298 | 1 299 | 300 | 301 | 1 302 | 303 | 304 | aggregate 305 | 306 | 307 | 1 308 | 309 | 310 | 311 | 312 | 313 | 1 314 | 1 315 | 316 | 317 | window 318 | 319 | 320 | aggregate 321 | 322 | 323 | 1 324 | 1 325 | 326 | 327 | window 328 | 329 | 330 | 1 331 | 332 | 333 | aggregate 334 | 335 | 336 | window 337 | 338 | 339 | window 340 | 341 | 342 | 1 343 | 344 | 345 | 1 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | window 354 | 355 | 356 | 1 357 | 358 | 359 | 1 360 | 361 | 362 | 1 363 | 364 | 365 | 1 366 | 1 367 | 368 | 369 | 370 | 1 371 | 372 | 373 | 1 374 | 375 | 376 | 377 | 378 | window 379 | 380 | 381 | 1 382 | 383 | 384 | 1 385 | 386 | 387 | 388 | 389 | 390 | 1 391 | 392 | 393 | window 394 | 395 | 396 | 1 397 | 398 | 399 | 400 | 401 | 1 402 | 403 | 404 | 1 405 | 406 | 407 | 1 408 | 409 | 410 | 1 411 | 412 | 413 | 1 414 | 415 | 416 | 417 | 418 | 1 419 | 420 | 421 | 422 | 423 | 1 424 | 425 | 426 | 427 | aggregate 428 | 429 | 430 | 431 | 1 432 | 1 433 | 434 | 435 | window 436 | 437 | 438 | 1 439 | 440 | 441 | 1 442 | 443 | 444 | 1 445 | 446 | 447 | window 448 | 449 | 450 | 1 451 | 452 | 453 | 1 454 | 455 | 456 | 1 457 | 1 458 | 459 | 460 | 1 461 | 462 | 463 | window 464 | 465 | 466 | 467 | 1 468 | 469 | 470 | 1 471 | 472 | 473 | 1 474 | 475 | 476 | 1 477 | 478 | 479 | 1 480 | 481 | 482 | 1 483 | 1 484 | 485 | 486 | 1 487 | 488 | 489 | 1 490 | 491 | 492 | aggregate 493 | 494 | 495 | aggregate 496 | 497 | 498 | 1 499 | 500 | 501 | 1 502 | 2024-09-01.14:19:01 503 | 504 | 505 | R 506 | 507 | 508 | 1 509 | 510 | 511 | 2 512 | 513 | 514 | R 515 | 516 | 517 | 1 518 | 519 | 520 | 2 521 | 522 | 523 | R 524 | 525 | 526 | 1 527 | 528 | 529 | R 530 | 531 | 532 | 1 533 | 534 | 535 | R 536 | 537 | 538 | 1 539 | 540 | 541 | R 542 | 543 | 544 | 1 545 | 546 | 547 | R 548 | 549 | 550 | 1 551 | 552 | 553 | R 554 | 555 | 556 | 1 557 | 558 | 559 | R 560 | 561 | 562 | 1 563 | 564 | 565 | 2 566 | 567 | 568 | R 569 | 570 | 571 | 1 572 | 573 | 574 | R 575 | 576 | 577 | 1 578 | 579 | 580 | 2 581 | 582 | 583 | R 584 | 585 | 586 | 1 587 | 588 | 589 | R 590 | 591 | 592 | R 593 | 594 | 595 | 1 596 | 597 | 598 | R 599 | 600 | 601 | 1 602 | 603 | 604 | R 605 | 606 | 607 | R 608 | 609 | 610 | R 611 | 612 | 613 | 1 614 | 615 | 616 | 2 617 | 618 | 619 | R 620 | 621 | 622 | 1 623 | 624 | 625 | 2 626 | 627 | 628 | 3 629 | 630 | 631 | R 632 | 633 | 634 | R 635 | 636 | 637 | R 638 | 639 | 640 | R 641 | 642 | 643 | 1 644 | 645 | 646 | R 647 | 648 | 649 | 1 650 | 651 | 652 | R 653 | 654 | 655 | 1 656 | 657 | 658 | R 659 | 660 | 661 | 1 662 | 663 | 664 | R 665 | 666 | 667 | 1 668 | 669 | 670 | R 671 | 672 | 673 | R 674 | 675 | 676 | R 677 | 678 | 679 | R 680 | 681 | 682 | R 683 | 684 | 685 | R 686 | 687 | 688 | R 689 | 690 | 691 | 1 692 | 693 | 694 | R 695 | 696 | 697 | R 698 | 699 | 700 | 1 701 | 702 | 703 | 2 704 | 705 | 706 | R 707 | 708 | 709 | 1 710 | 711 | 712 | R 713 | 714 | 715 | 1 716 | 717 | 718 | R 719 | 720 | 721 | 1 722 | 723 | 724 | R 725 | 726 | 727 | R 728 | 729 | 730 | 1 731 | 732 | 733 | R 734 | 735 | 736 | 1 737 | 738 | 739 | 2 740 | 741 | 742 | R 743 | 744 | 745 | 1 746 | 747 | 748 | R 749 | 750 | 751 | R 752 | 753 | 754 | 1 755 | 756 | 757 | 2 758 | 759 | 760 | R 761 | 762 | 763 | 1 764 | 765 | 766 | 2 767 | 768 | 769 | R 770 | 771 | 772 | 1 773 | 774 | 775 | R 776 | 777 | 778 | R 779 | 780 | 781 | 1 782 | 783 | 784 | 2 785 | 786 | 787 | R 788 | 789 | 790 | 1 791 | 792 | 793 | 2 794 | 795 | 796 | 3 797 | 798 | 799 | R 800 | 801 | 802 | 1 803 | 804 | 805 | 2 806 | 807 | 808 | R 809 | 810 | 811 | 1 812 | 813 | 814 | R 815 | 816 | 817 | R 818 | 819 | 820 | 1 821 | 822 | 823 | 2 824 | 825 | 826 | R 827 | 828 | 829 | 1 830 | 831 | 832 | R 833 | 834 | 835 | R 836 | 837 | 838 | 1 839 | 840 | 841 | R 842 | 843 | 844 | 1 845 | 846 | 847 | 2 848 | 849 | 850 | R 851 | 852 | 853 | R 854 | 855 | 856 | R 857 | 858 | 859 | 1 860 | 861 | 862 | 2 863 | 864 | 865 | R 866 | 867 | 868 | 1 869 | 870 | 871 | R 872 | 873 | 874 | R 875 | 876 | 877 | R 878 | 879 | 880 | R 881 | 882 | 883 | 1 884 | 885 | 886 | 2 887 | 888 | 889 | R 890 | 891 | 892 | 1 893 | 894 | 895 | 2 896 | 897 | 898 | R 899 | 900 | 901 | 1 902 | 903 | 904 | R 905 | 906 | 907 | R 908 | 909 | 910 | R 911 | 912 | 913 | 1 914 | 915 | 916 | R 917 | 918 | 919 | 1 920 | 921 | 922 | 2 923 | 924 | 925 | R 926 | 927 | 928 | R 929 | 930 | 931 | R 932 | 933 | 934 | 1 935 | 936 | 937 | 2 938 | 939 | 940 | R 941 | 942 | 943 | R 944 | 945 | 946 | R 947 | 948 | 949 | R 950 | 951 | 952 | R 953 | 954 | 955 | 1 956 | 957 | 958 | 2 959 | 960 | 961 | R 962 | 963 | 964 | 1 965 | 966 | 967 | 2 968 | 969 | 970 | 3 971 | 972 | 973 | R 974 | 975 | 976 | R 977 | 978 | 979 | 1 980 | 981 | 982 | R 983 | 984 | 985 | 1 986 | 987 | 988 | 2 989 | 990 | 991 | R 992 | 993 | 994 | 1 995 | 996 | 997 | 2 998 | 999 | 1000 | 3 1001 | 1002 | 1003 | R 1004 | 1005 | 1006 | 1 1007 | 1008 | 1009 | 2 1010 | 1011 | 1012 | R 1013 | 1014 | 1015 | 1 1016 | 1017 | 1018 | R 1019 | 1020 | 1021 | 1 1022 | 1023 | 1024 | 2 1025 | 1026 | 1027 | 3 1028 | 1029 | 1030 | R 1031 | 1032 | 1033 | 1 1034 | 1035 | 1036 | 2 1037 | 1038 | 1039 | R 1040 | 1041 | 1042 | 1 1043 | 1044 | 1045 | R 1046 | 1047 | 1048 | 1 1049 | 1050 | 1051 | R 1052 | 1053 | 1054 | 1 1055 | 1056 | 1057 | 2 1058 | 1059 | 1060 | R 1061 | 1062 | 1063 | 1 1064 | 1065 | 1066 | 2 1067 | 1068 | 1069 | R 1070 | 1071 | 1072 | 1 1073 | 1074 | 1075 | R 1076 | 1077 | 1078 | 1 1079 | 1080 | 1081 | R 1082 | 1083 | 1084 | 1 1085 | 1086 | 1087 | R 1088 | 1089 | 1090 | 1 1091 | 1092 | 1093 | R 1094 | 1095 | 1096 | 1 1097 | 1098 | 1099 | 2 1100 | 1101 | 1102 | R 1103 | 1104 | 1105 | 1 1106 | 1107 | 1108 | 2 1109 | 1110 | 1111 | R 1112 | 1113 | 1114 | 1 1115 | 1116 | 1117 | R 1118 | 1119 | 1120 | 1 1121 | 1122 | 1123 | 2 1124 | 1125 | 1126 | R 1127 | 1128 | 1129 | R 1130 | 1131 | 1132 | 1 1133 | 1134 | 1135 | R 1136 | 1137 | 1138 | 1 1139 | 1140 | 1141 | R 1142 | 1143 | 1144 | R 1145 | 1146 | 1147 | 1 1148 | 1149 | 1150 | R 1151 | 1152 | 1153 | 1 1154 | 1155 | 1156 | 2 1157 | 1158 | 1159 | R 1160 | 1161 | 1162 | 1 1163 | 1164 | 1165 | R 1166 | 1167 | 1168 | 1 1169 | 1170 | 1171 | 2 1172 | 1173 | 1174 | R 1175 | 1176 | 1177 | 1 1178 | 1179 | 1180 | R 1181 | 1182 | 1183 | 1 1184 | 1185 | 1186 | 2 1187 | 1188 | 1189 | R 1190 | 1191 | 1192 | 1 1193 | 1194 | 1195 | R 1196 | 1197 | 1198 | 1 1199 | 1200 | 1201 | R 1202 | 1203 | 1204 | 1 1205 | 1206 | 1207 | R 1208 | 1209 | 1210 | 1 1211 | 1212 | 1213 | 2 1214 | 1215 | 1216 | R 1217 | 1218 | 1219 | 1 1220 | 1221 | 1222 | 2 1223 | 1224 | 1225 | R 1226 | 1227 | 1228 | 1 1229 | 1230 | 1231 | 2 1232 | 1233 | 1234 | R 1235 | 1236 | 1237 | R 1238 | 1239 | 1240 | R 1241 | 1242 | 1243 | 1 1244 | 1245 | 1246 | 2 1247 | 1248 | 1249 | R 1250 | 1251 | 1252 | 1 1253 | 1254 | 1255 | 2 1256 | 1257 | 1258 | R 1259 | 1260 | 1261 | R 1262 | 1263 | 1264 | 1 1265 | 1266 | 1267 | R 1268 | 1269 | 1270 | 1 1271 | 1272 | 1273 | R 1274 | 1275 | 1276 | 1 1277 | 1278 | 1279 | R 1280 | 1281 | 1282 | R 1283 | 1284 | 1285 | 1 1286 | 1287 | 1288 | R 1289 | 1290 | 1291 | R 1292 | 1293 | 1294 | R 1295 | 1296 | 1297 | 1 1298 | 1299 | 1300 | 2 1301 | 1302 | 1303 | 3 1304 | 1305 | 1306 | R 1307 | 1308 | 1309 | 1 1310 | 1311 | 1312 | 2 1313 | 1314 | 1315 | R 1316 | 1317 | 1318 | 1 1319 | 1320 | 1321 | R 1322 | 1323 | 1324 | 1 1325 | 1326 | 1327 | 2 1328 | 1329 | 1330 | R 1331 | 1332 | 1333 | 1 1334 | 1335 | 1336 | 2 1337 | 1338 | 1339 | R 1340 | 1341 | 1342 | R 1343 | 1344 | 1345 | R 1346 | 1347 | 1348 | 1 1349 | 1350 | 1351 | R 1352 | 1353 | 1354 | 1 1355 | 1356 | 1357 | 2 1358 | 1359 | 1360 | R 1361 | 1362 | 1363 | 1 1364 | 1365 | 1366 | 2 1367 | 1368 | 1369 | R 1370 | 1371 | 1372 | 1 1373 | 1374 | 1375 | R 1376 | 1377 | 1378 | 1 1379 | 1380 | 1381 | R 1382 | 1383 | 1384 | 1 1385 | 1386 | 1387 | R 1388 | 1389 | 1390 | R 1391 | 1392 | 1393 | 1 1394 | 1395 | 1396 | R 1397 | 1398 | 1399 | 1 1400 | 1401 | 1402 | R 1403 | 1404 | 1405 | 1 1406 | 1407 | 1408 | 2 1409 | 1410 | 1411 | R 1412 | 1413 | 1414 | R 1415 | 1416 | 1417 | R 1418 | 1419 | 1420 | 1 1421 | 1422 | 1423 | R 1424 | 1425 | 1426 | 1 1427 | 1428 | 1429 | R 1430 | 1431 | 1432 | 1 1433 | 1434 | 1435 | R 1436 | 1437 | 1438 | 1 1439 | 1440 | 1441 | 2 1442 | 1443 | 1444 | R 1445 | 1446 | 1447 | R 1448 | 1449 | 1450 | 1 1451 | 1452 | 1453 | 2 1454 | 1455 | 1456 | R 1457 | 1458 | 1459 | 1 1460 | 1461 | 1462 | 2 1463 | 1464 | 1465 | 3 1466 | 1467 | 1468 | R 1469 | 1470 | 1471 | 1 1472 | 1473 | 1474 | 2 1475 | 1476 | 1477 | 3 1478 | 1479 | 1480 | R 1481 | 1482 | 1483 | 1 1484 | 1485 | 1486 | R 1487 | 1488 | 1489 | 1 1490 | 1491 | 1492 | R 1493 | 1494 | 1495 | 1 1496 | 1497 | 1498 | R 1499 | 1500 | 1501 | 1 1502 | 1503 | 1504 | R 1505 | 1506 | 1507 | R 1508 | 1509 | 1510 | 1 1511 | 1512 | 1513 | 2 1514 | 1515 | 1516 | R 1517 | 1518 | 1519 | 1 1520 | 1521 | 1522 | R 1523 | 1524 | 1525 | R 1526 | 1527 | 1528 | 1 1529 | 1530 | 1531 | 2 1532 | 1533 | 1534 | R 1535 | 1536 | 1537 | 1 1538 | 1539 | 1540 | R 1541 | 1542 | 1543 | 1 1544 | 1545 | 1546 | R 1547 | 1548 | 1549 | 1 1550 | 1551 | 1552 | 2 1553 | 1554 | 1555 | R 1556 | 1557 | 1558 | 1 1559 | 1560 | 1561 | R 1562 | 1563 | 1564 | R 1565 | 1566 | 1567 | 1 1568 | 1569 | 1570 | R 1571 | 1572 | 1573 | 1 1574 | 1575 | 1576 | R 1577 | 1578 | 1579 | 1 1580 | 1581 | 1582 | R 1583 | 1584 | 1585 | 1 1586 | 1587 | 1588 | R 1589 | 1590 | 1591 | 1 1592 | 1593 | 1594 |
1595 |
1596 |
1597 |
1598 |
1599 |
1600 |
1601 |
1602 |
1603 |
1604 |
1605 |
1606 | 1 1607 |
1608 | 1609 | 1 1610 |
1611 | 1612 | 1 1613 | 1 1614 | 1 1615 | integer|0s 1616 | 1617 | 1618 | 1 1619 | 2 1620 | varchar(150)|0s 1621 | 1622 | 1623 | name 1624 | 1 1625 | 1 1626 | 1627 | 1628 | id 1629 | 1 1630 | 1631 | 1632 | name 1633 | sqlite_autoindex_auth_group_1 1634 | 1635 | 1636 | 1 1637 | 1 1638 | 1 1639 | integer|0s 1640 | 1641 | 1642 | 1 1643 | 2 1644 | integer|0s 1645 | 1646 | 1647 | 1 1648 | 3 1649 | integer|0s 1650 | 1651 | 1652 | group_id 1653 | 1 1654 | 1 1655 | id 1656 | auth_group 1657 | 1658 | 1659 | permission_id 1660 | 1 1661 | 1 1662 | id 1663 | auth_permission 1664 | 1665 | 1666 | group_id 1667 | permission_id 1668 | 1 1669 | 1670 | 1671 | group_id 1672 | 1673 | 1674 | permission_id 1675 | 1676 | 1677 | id 1678 | 1 1679 | 1680 | 1681 | 1 1682 | 1 1683 | 1 1684 | integer|0s 1685 | 1686 | 1687 | 1 1688 | 2 1689 | integer|0s 1690 | 1691 | 1692 | 1 1693 | 3 1694 | varchar(100)|0s 1695 | 1696 | 1697 | 1 1698 | 4 1699 | varchar(255)|0s 1700 | 1701 | 1702 | content_type_id 1703 | 1 1704 | 1 1705 | id 1706 | django_content_type 1707 | 1708 | 1709 | content_type_id 1710 | codename 1711 | 1 1712 | 1713 | 1714 | content_type_id 1715 | 1716 | 1717 | id 1718 | 1 1719 | 1720 | 1721 | 1 1722 | 1 1723 | 1 1724 | integer|0s 1725 | 1726 | 1727 | 1 1728 | 2 1729 | varchar(128)|0s 1730 | 1731 | 1732 | 3 1733 | datetime|0s 1734 | 1735 | 1736 | 1 1737 | 4 1738 | bool|0s 1739 | 1740 | 1741 | 1 1742 | 5 1743 | varchar(150)|0s 1744 | 1745 | 1746 | 1 1747 | 6 1748 | varchar(150)|0s 1749 | 1750 | 1751 | 1 1752 | 7 1753 | varchar(254)|0s 1754 | 1755 | 1756 | 1 1757 | 8 1758 | bool|0s 1759 | 1760 | 1761 | 1 1762 | 9 1763 | bool|0s 1764 | 1765 | 1766 | 1 1767 | 10 1768 | datetime|0s 1769 | 1770 | 1771 | 1 1772 | 11 1773 | varchar(150)|0s 1774 | 1775 | 1776 | username 1777 | 1 1778 | 1 1779 | 1780 | 1781 | id 1782 | 1 1783 | 1784 | 1785 | username 1786 | sqlite_autoindex_auth_user_1 1787 | 1788 | 1789 | 1 1790 | 1 1791 | 1 1792 | integer|0s 1793 | 1794 | 1795 | 1 1796 | 2 1797 | integer|0s 1798 | 1799 | 1800 | 1 1801 | 3 1802 | integer|0s 1803 | 1804 | 1805 | user_id 1806 | 1 1807 | 1 1808 | id 1809 | auth_user 1810 | 1811 | 1812 | group_id 1813 | 1 1814 | 1 1815 | id 1816 | auth_group 1817 | 1818 | 1819 | user_id 1820 | group_id 1821 | 1 1822 | 1823 | 1824 | user_id 1825 | 1826 | 1827 | group_id 1828 | 1829 | 1830 | id 1831 | 1 1832 | 1833 | 1834 | 1 1835 | 1 1836 | 1 1837 | integer|0s 1838 | 1839 | 1840 | 1 1841 | 2 1842 | integer|0s 1843 | 1844 | 1845 | 1 1846 | 3 1847 | integer|0s 1848 | 1849 | 1850 | user_id 1851 | 1 1852 | 1 1853 | id 1854 | auth_user 1855 | 1856 | 1857 | permission_id 1858 | 1 1859 | 1 1860 | id 1861 | auth_permission 1862 | 1863 | 1864 | user_id 1865 | permission_id 1866 | 1 1867 | 1868 | 1869 | user_id 1870 | 1871 | 1872 | permission_id 1873 | 1874 | 1875 | id 1876 | 1 1877 | 1878 | 1879 | "action_flag" >= 0 1880 | 1881 | 1882 | 1 1883 | 1 1884 | 1 1885 | integer|0s 1886 | 1887 | 1888 | 2 1889 | text|0s 1890 | 1891 | 1892 | 1 1893 | 3 1894 | varchar(200)|0s 1895 | 1896 | 1897 | 1 1898 | 4 1899 | smallint unsigned|0s 1900 | 1901 | 1902 | 1 1903 | 5 1904 | text|0s 1905 | 1906 | 1907 | 6 1908 | integer|0s 1909 | 1910 | 1911 | 1 1912 | 7 1913 | integer|0s 1914 | 1915 | 1916 | 1 1917 | 8 1918 | datetime|0s 1919 | 1920 | 1921 | content_type_id 1922 | 1 1923 | 1 1924 | id 1925 | django_content_type 1926 | 1927 | 1928 | user_id 1929 | 1 1930 | 1 1931 | id 1932 | auth_user 1933 | 1934 | 1935 | content_type_id 1936 | 1937 | 1938 | user_id 1939 | 1940 | 1941 | id 1942 | 1 1943 | 1944 | 1945 | 1 1946 | 1 1947 | 1 1948 | integer|0s 1949 | 1950 | 1951 | 1 1952 | 2 1953 | varchar(100)|0s 1954 | 1955 | 1956 | 1 1957 | 3 1958 | varchar(100)|0s 1959 | 1960 | 1961 | app_label 1962 | model 1963 | 1 1964 | 1965 | 1966 | id 1967 | 1 1968 | 1969 | 1970 | 1 1971 | 1 1972 | 1 1973 | integer|0s 1974 | 1975 | 1976 | 1 1977 | 2 1978 | varchar(255)|0s 1979 | 1980 | 1981 | 1 1982 | 3 1983 | varchar(255)|0s 1984 | 1985 | 1986 | 1 1987 | 4 1988 | datetime|0s 1989 | 1990 | 1991 | id 1992 | 1 1993 | 1994 | 1995 | 1 1996 | 1 1997 | varchar(40)|0s 1998 | 1999 | 2000 | 1 2001 | 2 2002 | text|0s 2003 | 2004 | 2005 | 1 2006 | 3 2007 | datetime|0s 2008 | 2009 | 2010 | session_key 2011 | 1 2012 | 1 2013 | 2014 | 2015 | expire_date 2016 | 2017 | 2018 | session_key 2019 | 1 2020 | sqlite_autoindex_django_session_1 2021 | 2022 | 2023 | 1 2024 | 1 2025 | 1 2026 | integer|0s 2027 | 2028 | 2029 | 1 2030 | 2 2031 | varchar(200)|0s 2032 | 2033 | 2034 | 1 2035 | 3 2036 | integer|0s 2037 | 2038 | 2039 | 1 2040 | 4 2041 | bigint|0s 2042 | 2043 | 2044 | 1 2045 | 5 2046 | bool|0s 2047 | 2048 | 2049 | question_id 2050 | 1 2051 | 1 2052 | id 2053 | polls_question 2054 | 2055 | 2056 | question_id 2057 | 2058 | 2059 | id 2060 | 1 2061 | 2062 | 2063 | 1 2064 | 1 2065 | 1 2066 | integer|0s 2067 | 2068 | 2069 | 1 2070 | 2 2071 | varchar(200)|0s 2072 | 2073 | 2074 | 1 2075 | 3 2076 | datetime|0s 2077 | 2078 | 2079 | id 2080 | 1 2081 | 2082 | 2083 | 1 2084 | TEXT|0s 2085 | 2086 | 2087 | 2 2088 | TEXT|0s 2089 | 2090 | 2091 | 3 2092 | TEXT|0s 2093 | 2094 | 2095 | 4 2096 | INT|0s 2097 | 2098 | 2099 | 5 2100 | TEXT|0s 2101 | 2102 | 2103 | 1 2104 | 2105 | 2106 | 2 2107 | 2108 |
2109 |
--------------------------------------------------------------------------------