szkielecik

This commit is contained in:
Jędrzej Klepacki 2020-12-03 20:21:17 +01:00
parent af00024fa4
commit 1e8d86e338
7 changed files with 31 additions and 3 deletions

View File

@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('homepage/', include('homepage.urls')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,18 @@
{% if all_product %}
<ul>
{% for product in all_product %}
<li>{{ product.user_owner }}<br>
{% if types.0.0 == product.type %}
Potrzebuje
{% endif %}
{% if types.1.0 == product.type %}
Oddam
{% endif %}
{{ product.title }}<br>
{{ product.place }}<br>
</li>
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}

View File

@ -1,6 +1,15 @@
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.template import loader
from .models import Product, TYPE_T
def index(request): 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))