szkielecik
This commit is contained in:
parent
af00024fa4
commit
1e8d86e338
Binary file not shown.
@ -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.
BIN
SocialHelper/homepage/__pycache__/urls.cpython-37.pyc
Normal file
BIN
SocialHelper/homepage/__pycache__/urls.cpython-37.pyc
Normal file
Binary file not shown.
BIN
SocialHelper/homepage/__pycache__/views.cpython-37.pyc
Normal file
BIN
SocialHelper/homepage/__pycache__/views.cpython-37.pyc
Normal file
Binary file not shown.
18
SocialHelper/homepage/templates/homepage/index.html
Normal file
18
SocialHelper/homepage/templates/homepage/index.html
Normal 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 %}
|
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user