From 384b2e7303a1001e5b13955f6a542edf47057479 Mon Sep 17 00:00:00 2001 From: Ray Lyon Date: Wed, 10 Dec 2025 21:03:51 -0500 Subject: [PATCH] Add polls app with basic views and URL routing --- django_movies/urls.py | 6 ++++-- polls/__init__.py | 0 polls/admin.py | 3 +++ polls/apps.py | 5 +++++ polls/migrations/__init__.py | 0 polls/models.py | 3 +++ polls/tests.py | 3 +++ polls/urls.py | 7 +++++++ polls/views.py | 9 +++++++++ 9 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 polls/__init__.py create mode 100644 polls/admin.py create mode 100644 polls/apps.py create mode 100644 polls/migrations/__init__.py create mode 100644 polls/models.py create mode 100644 polls/tests.py create mode 100644 polls/urls.py create mode 100644 polls/views.py diff --git a/django_movies/urls.py b/django_movies/urls.py index bc76a93..458b564 100644 --- a/django_movies/urls.py +++ b/django_movies/urls.py @@ -14,9 +14,11 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin -from django.urls import path +from django.urls import include, path urlpatterns = [ - path('admin/', admin.site.urls), + path("admin/", admin.site.urls), + path("polls/", include("polls.urls")), ] diff --git a/polls/__init__.py b/polls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polls/admin.py b/polls/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/polls/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/polls/apps.py b/polls/apps.py new file mode 100644 index 0000000..d0f109e --- /dev/null +++ b/polls/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class PollsConfig(AppConfig): + name = 'polls' diff --git a/polls/migrations/__init__.py b/polls/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polls/models.py b/polls/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/polls/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/polls/tests.py b/polls/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/polls/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/polls/urls.py b/polls/urls.py new file mode 100644 index 0000000..5119061 --- /dev/null +++ b/polls/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path("", views.index, name="index"), +] diff --git a/polls/views.py b/polls/views.py new file mode 100644 index 0000000..d8959da --- /dev/null +++ b/polls/views.py @@ -0,0 +1,9 @@ +from django.http import HttpResponse + + +def index(request): + return HttpResponse("Hello, world. You're at the polls index.") + + +def index2(request): + return HttpResponse("Hello, world. You're at the polls index #2.")