This commit is contained in:
Jędrzej Klepacki 2020-12-20 23:39:57 +01:00
parent 9bdd149c8f
commit d4ecffc0a2
5 changed files with 54 additions and 4 deletions

View File

@ -15,9 +15,9 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="#">Wszystko</a></li> <li class="nav-item"><a class="nav-link" href="all">Wszystko</a></li>
<li class="nav-item"><a class="nav-link" href="#">Produkty</a></li> <li class="nav-item"><a class="nav-link" href="product">Produkty</a></li>
<li class="nav-item"><a class="nav-link" href="#">Usługi</a></li> <li class="nav-item"><a class="nav-link" href="offer">Usługi</a></li>
<li class="nav-item"><a class="nav-link" href="contact">Kontakt</a></li> <li class="nav-item"><a class="nav-link" href="contact">Kontakt</a></li>
</ul> </ul>
</div> </div>

View File

@ -5,6 +5,11 @@ from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'),
path('product', views.index_product, name='index_product'),
path('offer', views.index_offer, name='index_offer'),
path('all', views.index, name='index'),
path('', views.index, name='index'), path('', views.index, name='index'),
path('contact', views.contact, name='contact'), path('contact', views.contact, name='contact'),
path('regulamin',views.regulamin, name='regulamin'), path('regulamin',views.regulamin, name='regulamin'),

View File

@ -36,6 +36,51 @@ def index(request):
} }
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))
def index_product(request):
all_product = Product.objects.filter(active = True, offer=2)
template = loader.get_template('homepage/index.html')
types = TYPE_T
types_o = TYPE_O
place_local = ""
oddam_local = ""
potrzebuje_local = ""
usluga_local = ""
przedmiot_local = "1"
context = {
'all_product': all_product,
'types': types,
'place_local': place_local,
'oddam_local': oddam_local,
'potrzebuje_local': potrzebuje_local,
'types_o': types_o,
'usluga_local': usluga_local,
'przedmiot_local': przedmiot_local,
}
return HttpResponse(template.render(context, request))
def index_offer(request):
all_product = Product.objects.filter(active = True, offer=1)
template = loader.get_template('homepage/index.html')
types = TYPE_T
types_o = TYPE_O
place_local = ""
oddam_local = ""
potrzebuje_local = ""
usluga_local = "1"
przedmiot_local = ""
context = {
'all_product': all_product,
'types': types,
'place_local': place_local,
'oddam_local': oddam_local,
'potrzebuje_local': potrzebuje_local,
'types_o': types_o,
'usluga_local': usluga_local,
'przedmiot_local': przedmiot_local,
}
return HttpResponse(template.render(context, request))
def contact(request): def contact(request):
return render(request , 'homepage/contact.html') return render(request , 'homepage/contact.html')
@ -231,7 +276,7 @@ def login(request):
return redirect(login) return redirect(login)
return render(request , 'homepage/login.html') return render(request , 'homepage/login.html')
def logout_user(request): def logout_user(request):
auth.logout(request) auth.logout(request)
messages.success(request, 'Zostałeś wylogowany!') messages.success(request, 'Zostałeś wylogowany!')
return redirect( index) return redirect( index)