This commit is contained in:
Jędrzej Klepacki 2021-01-03 15:10:42 +01:00
parent f6df894f2a
commit dcd567f979
20 changed files with 58 additions and 35 deletions

View File

@ -33,6 +33,7 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [ INSTALLED_APPS = [
'homepage.apps.HomepageConfig', 'homepage.apps.HomepageConfig',
'enGB.apps.EngbConfig', 'enGB.apps.EngbConfig',
'django.contrib.postgres',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',

View File

@ -17,7 +17,7 @@
<!--================End Categories Banner Area =================--> <!--================End Categories Banner Area =================-->
<!--================Register Area =================--> <!--================Register Area =================-->
<form action="{% url 'add_comment' user_name %}" method="POST" enctype="multipart/form-data"> <form action="{% url 'enadd_comment' user_name %}" method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.media }} {{ form.media }}
{{ form.as_p }} {{ form.as_p }}

View File

@ -18,7 +18,7 @@
<!--================End Categories Banner Area =================--> <!--================End Categories Banner Area =================-->
<!--================Register Area =================--> <!--================Register Area =================-->
<form action="{% url 'add_offer' %}" method="POST" enctype="multipart/form-data"> <form action="{% url 'enadd_offer' %}" method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.media }} {{ form.media }}
{{ form.as_p }} {{ form.as_p }}

View File

@ -102,7 +102,7 @@ body {font-family: Arial, Helvetica, sans-serif;}
<!--================End Categories Banner Area =================--> <!--================End Categories Banner Area =================-->
<!--================Register Area =================--> <!--================Register Area =================-->
<form action="{% url 'create_user' %}" method="POST" enctype="multipart/form-data"> <form action="{% url 'encreate_user' %}" method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.media }} {{ form.media }}
{{ form.as_p }} {{ form.as_p }}

View File

@ -16,7 +16,7 @@
<!--================End Categories Banner Area =================--> <!--================End Categories Banner Area =================-->
<!--================Register Area =================--> <!--================Register Area =================-->
<form action="{% url 'edit_user' %}" method="POST" enctype="multipart/form-data"> <form action="{% url 'enedit_user' %}" method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.media }} {{ form.media }}
{{ form.as_p }} {{ form.as_p }}

View File

@ -16,7 +16,7 @@
<!--================End Categories Banner Area =================--> <!--================End Categories Banner Area =================-->
<!--================Register Area =================--> <!--================Register Area =================-->
<form action="{% url 'edit_offer' offer.id %}" method="POST" enctype="multipart/form-data"> <form action="{% url 'enedit_offer' offer.id %}" method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.media }} {{ form.media }}
{{ form.as_p }} {{ form.as_p }}

View File

@ -85,7 +85,7 @@
</div> </div>
</div> </div>
<form action="{% url 'filter' %}" method="post"> <form action="{% url 'enfilter' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="place" value=""> <input type="hidden" name="place" value="">

View File

@ -67,7 +67,7 @@
<a href="edit_user"><button type="button" class="btn btn-primary pull-right">Change Password</button></a> <a href="edit_user"><button type="button" class="btn btn-primary pull-right">Change Password</button></a>
</div> </div>
<form action="{% url 'filter' %}" method="post"> <form action="{% url 'enfilter' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="place" value=""> <input type="hidden" name="place" value="">

View File

@ -80,7 +80,7 @@
</div> </div>
</div> </div>
<form action="{% url 'filter' %}" method="post"> <form action="{% url 'enfilter' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="place" value=""> <input type="hidden" name="place" value="">
@ -113,7 +113,7 @@
</div> </div>
</div> </div>
<form action="{% url 'filter' %}" method="post"> <form action="{% url 'enfilter' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="place" value=""> <input type="hidden" name="place" value="">

View File

@ -15,7 +15,7 @@
<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="all">All Offers</a></li> <li class="nav-item"><a class="nav-link" href="all">All</a></li>
<li class="nav-item"><a class="nav-link" href="product">Product</a></li> <li class="nav-item"><a class="nav-link" href="product">Product</a></li>
<li class="nav-item"><a class="nav-link" href="offer">Services</a></li> <li class="nav-item"><a class="nav-link" href="offer">Services</a></li>
<li class="nav-item"><a class="nav-link" href="contact">Contact</a></li> <li class="nav-item"><a class="nav-link" href="contact">Contact</a></li>
@ -28,7 +28,7 @@
<li ><a href="/enGB/add_offer"><img src="{% static "plus.png"%}" height="20"/></a></li> <li ><a href="/enGB/add_offer"><img src="{% static "plus.png"%}" height="20"/></a></li>
<li> <a href="/enGB/logout_user"><img src="{% static "logout.png"%}" height="25"/></a></li> <li> <a href="/enGB/logout_user"><img src="{% static "logout.png"%}" height="25"/></a></li>
{% else %} {% else %}
<li> <a href="/enGB/login"><img src="{% static "login.png"%}" height="25"/></a></li> <li> <a href="/enGB/enlogin"><img src="{% static "login.png"%}" height="25"/></a></li>
{% endif %} {% endif %}
<li ><a href="/homepage"><img src="{% static "PL.png"%}" height="20"/></a></li> <li ><a href="/homepage"><img src="{% static "PL.png"%}" height="20"/></a></li>
<li ><a href="/enGB"><img src="{% static "en.jpg"%}" height="20"/></a></li> <li ><a href="/enGB"><img src="{% static "en.jpg"%}" height="20"/></a></li>

View File

@ -5,27 +5,27 @@ from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path('', views.enindex, name='index'), path('', views.enindex, name='enindex'),
path('product', views.enindex_product, name='index_product'), path('product', views.enindex_product, name='enindex_product'),
path('offer', views.enindex_offer, name='index_offer'), path('offer', views.enindex_offer, name='enindex_offer'),
path('all', views.enindex, name='index'), path('all', views.enindex, name='enindex'),
path('', views.enindex, name='index'), path('', views.enindex, name='enindex'),
path('contact', views.encontact, name='contact'), path('contact', views.encontact, name='encontact'),
path('regulamin',views.enregulamin, name='regulamin'), path('regulamin',views.enregulamin, name='enregulamin'),
path('filter', views.enfilter, name='filter'), path('filter', views.enfilter, name='enfilter'),
path('add_offer', views.enadd_offer, name='add_offer'), path('add_offer', views.enadd_offer, name='enadd_offer'),
path('my_offer', views.enmy_offer, name='my_offer'), path('my_offer', views.enmy_offer, name='enmy_offer'),
path('<int:offer_id>/delete_offer', views.endelete_offer, name='delete_offer'), path('<int:offer_id>/delete_offer', views.endelete_offer, name='endelete_offer'),
path('<int:offer_id>/edit_offer', views.enedit_offer, name='edit_offer'), path('<int:offer_id>/edit_offer', views.enedit_offer, name='enedit_offer'),
path('create_user', views.encreate_user, name='create_user'), path('create_user', views.encreate_user, name='encreate_user'),
path('enlogin', views.enlogin, name='enlogin'), path('enlogin', views.enlogin, name='enlogin'),
path('delete_user', views.endelete_user, name='delete_user'), path('delete_user', views.endelete_user, name='endelete_user'),
path('logout_user', views.enlogout_user, name='logout_user'), path('logout_user', views.enlogout_user, name='enlogout_user'),
path('<int:user_id>/delete_user', views.endelete_user, name='delete_user'), path('<int:user_id>/delete_user', views.endelete_user, name='endelete_user'),
path('edit_user', views.enedit_user, name='edit_user'), path('edit_user', views.enedit_user, name='enedit_user'),
path('user_profile/<str:user_name>', views.enuser_profile, name='user_profile'), path('user_profile/<str:user_name>', views.enuser_profile, name='enuser_profile'),
path('user_profile/<str:user_name>/add_comment', views.enadd_comment, name='add_comment'), path('user_profile/<str:user_name>/add_comment', views.enadd_comment, name='enadd_comment'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -128,7 +128,7 @@ def enfilter(request):
if place_local != "": if place_local != "":
all_product = all_product.filter(place=place_local) all_product = all_product.filter(place__unaccent__icontains=place_local)
if oddam_local == "on" and potrzebuje_local != "on": if oddam_local == "on" and potrzebuje_local != "on":
zmienna = 2 zmienna = 2
@ -409,7 +409,7 @@ def enedit_user(request):
instant.set_password(newpassword1) instant.set_password(newpassword1)
instant.save() instant.save()
messages.success(request,'Hasło zmienione, nastąpiło wylogowanie!') messages.success(request,'Hasło zmienione, nastąpiło wylogowanie!')
return redirect('my_offer') return redirect('enmy_offer')
return render(request , 'enGB/edit_user.html') return render(request , 'enGB/edit_user.html')
@ -434,7 +434,10 @@ def enlogout_user(request):
def enuser_profile(request, user_name): def enuser_profile(request, user_name):
User = get_user_model() User = get_user_model()
if User.objects.filter(username=user_name).exists():
user_prof = User.objects.filter(username=user_name).first() user_prof = User.objects.filter(username=user_name).first()
else:
user_prof = User.objects.filter(email=user_name).first()
all_product = Product.objects.filter(active = True, user_iden = user_prof.id) all_product = Product.objects.filter(active = True, user_iden = user_prof.id)
oceny = Ocena.objects.filter(user_iden = user_prof.id) oceny = Ocena.objects.filter(user_iden = user_prof.id)

View File

@ -0,0 +1,14 @@
# Generated by Django 3.1.4 on 2021-01-03 13:57
from django.contrib.postgres.operations import UnaccentExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
UnaccentExtension()
]

View File

@ -13,7 +13,9 @@
<h5>{{ name }}</h5> <h5>{{ name }}</h5>
<label>Neutralne</label><br> <label>Neutralne</label><br>
<label style="color:red">Niepolecany</label><input type="range" style="width: 500px;" id="volume" name="volume" min="0" max="100" value = "{{ ocena }}" disabled="True" color="Blue"><label style="color:limegreen">Polecany</label> <label style="color:red">Niepolecany</label><input type="range" style="width: 500px;" id="volume" name="volume" min="0" max="100" value = "{{ ocena }}" disabled="True" color="Blue"><label style="color:limegreen">Polecany</label>
{% if user.email %}
<p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Oceń Użytkownika</button></a> <p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Oceń Użytkownika</button></a>
{% endif %}
</div> </div>
</div> </div>
</section> </section>

View File

@ -128,7 +128,7 @@ def filter(request):
if place_local != "": if place_local != "":
all_product = all_product.filter(place=place_local) all_product = all_product.filter(place__unaccent__icontains=place_local)
if oddam_local == "on" and potrzebuje_local != "on": if oddam_local == "on" and potrzebuje_local != "on":
zmienna = 2 zmienna = 2
@ -434,7 +434,10 @@ def logout_user(request):
def user_profile(request, user_name): def user_profile(request, user_name):
User = get_user_model() User = get_user_model()
if User.objects.filter(username=user_name).exists():
user_prof = User.objects.filter(username=user_name).first() user_prof = User.objects.filter(username=user_name).first()
else:
user_prof = User.objects.filter(email=user_name).first()
all_product = Product.objects.filter(active = True, user_iden = user_prof.id) all_product = Product.objects.filter(active = True, user_iden = user_prof.id)
oceny = Ocena.objects.filter(user_iden = user_prof.id) oceny = Ocena.objects.filter(user_iden = user_prof.id)