diff --git a/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc b/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc index 4e347af..7d29b82 100644 Binary files a/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc and b/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc differ diff --git a/SocialHelper/SocialHelper/urls.py b/SocialHelper/SocialHelper/urls.py index bea4be4..5f16db5 100644 --- a/SocialHelper/SocialHelper/urls.py +++ b/SocialHelper/SocialHelper/urls.py @@ -14,8 +14,9 @@ Including another URLconf 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('homepage/', include('homepage.urls')), path('admin/', admin.site.urls), ] diff --git a/SocialHelper/homepage/__pycache__/models.cpython-37.pyc b/SocialHelper/homepage/__pycache__/models.cpython-37.pyc index d1a08e9..c6a53e5 100644 Binary files a/SocialHelper/homepage/__pycache__/models.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/models.cpython-37.pyc differ diff --git a/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc b/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..d5f7a60 Binary files /dev/null and b/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc differ diff --git a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000..159b7bf Binary files /dev/null and b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc differ diff --git a/SocialHelper/homepage/templates/homepage/index.html b/SocialHelper/homepage/templates/homepage/index.html new file mode 100644 index 0000000..e829d81 --- /dev/null +++ b/SocialHelper/homepage/templates/homepage/index.html @@ -0,0 +1,18 @@ +{% if all_product %} +
No polls are available.
+{% endif %} diff --git a/SocialHelper/homepage/views.py b/SocialHelper/homepage/views.py index 1252696..b7c498d 100644 --- a/SocialHelper/homepage/views.py +++ b/SocialHelper/homepage/views.py @@ -1,6 +1,15 @@ from django.shortcuts import render from django.http import HttpResponse - +from django.template import loader +from .models import Product, TYPE_T def index(request): - return HttpResponse("Hello, world. You're at the polls index.") + all_product = Product.objects.all + template = loader.get_template('homepage/index.html') + types = TYPE_T + print(types) + context = { + 'all_product': all_product, + 'types': types, + } + return HttpResponse(template.render(context, request))