From 1e8d86e338fc28f621314ea6b0c3c8a92aa204dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Klepacki?= Date: Thu, 3 Dec 2020 20:21:17 +0100 Subject: [PATCH] szkielecik --- .../__pycache__/urls.cpython-37.pyc | Bin 924 -> 982 bytes SocialHelper/SocialHelper/urls.py | 3 ++- .../__pycache__/models.cpython-37.pyc | Bin 743 -> 743 bytes .../homepage/__pycache__/urls.cpython-37.pyc | Bin 0 -> 269 bytes .../homepage/__pycache__/views.cpython-37.pyc | Bin 0 -> 633 bytes .../homepage/templates/homepage/index.html | 18 ++++++++++++++++++ SocialHelper/homepage/views.py | 13 +++++++++++-- 7 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 SocialHelper/homepage/__pycache__/urls.cpython-37.pyc create mode 100644 SocialHelper/homepage/__pycache__/views.cpython-37.pyc create mode 100644 SocialHelper/homepage/templates/homepage/index.html diff --git a/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc b/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc index 4e347af6d48dff18b83e7c532d584efacc510721..7d29b8250191e8fd1bd3da7b4dbce4acfe7bd9d9 100644 GIT binary patch delta 207 zcmbQkevMt-iIgoZ>3B#FX63Jbgb+&dJ}I4AhH2w%%eX&MX0H1u3}24J3hPl%y8r d6|ZC{0=c({YqBS^Cl3dZ$->CPD8S6a2mognG&%qP delta 125 zcmcb{K8Ic1iI5NhADXhT^nrs_$I+=tRZ?P04mSj}1C8p$N=IQ%sa!l4@HkcgGEW^eLG@*!dawD@R O7aNet!pOtO!wdjym==ft 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 d1a08e997cd5dde05025459d47bb09f16f876e05..c6a53e566e7fdb2829731a392f72af7c61529e1e 100644 GIT binary patch delta 19 ZcmaFP`ka-^iI delta 19 ZcmaFP`ka-^iI)&;e&crkNUl<=MW+4ejt8H?ZG&{D~mX%tr@zp+It&(CgVQ6 z_j#g1D9)uLw|4A@@D4uN{-y8p>s4Fd-?sJm*c*Gpc4GfuY(~eE>9|eDtLZh))^4P| N<%{Giq#p}hs2`_1Llyu4 literal 0 HcmV?d00001 diff --git a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..159b7bf8a981c9d4efa7e480bc97aa0654d7cbdf GIT binary patch literal 633 zcmY*Wy>1jS5cbdh-Q_|;@)X+~5)~kX5K*MiL=l%JtCLR4dUQYXt`~a_60}!^cc7t2 zN*;uQS8$suuRz6kb%|iC8GrM6ni8dvj+>;QN3!k1@qt+GrPWjkNXjVNcV&S z;~5|Fh-X5O+e2bb^I@^CR%J6cW4ACCt2Me_pWoTi3;L8^w%^+_k3#!dliDcIu78Vu e)c)dL^grQ%n)&QC)vh(X2|wq;)FU3&zW56STc0KX literal 0 HcmV?d00001 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 %} +
    + {% for product in all_product %} +
  • {{ product.user_owner }}
    + {% if types.0.0 == product.type %} + Potrzebuje + {% endif %} + {% if types.1.0 == product.type %} + Oddam + {% endif %} + {{ product.title }}
    + {{ product.place }}
    +
  • + {% endfor %} +
+{% else %} +

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))