This commit is contained in:
Jędrzej Klepacki 2021-01-03 15:57:40 +01:00
parent 7e408cf934
commit 7514ec2617
9 changed files with 263 additions and 255 deletions

View File

@ -92,37 +92,38 @@
</div> </div>
<div class="tab-pane" id="2zakladka"> <div class="tab-pane" id="2zakladka">
<div class="categories_main_inner"> <div class="categories_main_inner">
<div class="row row_disable"> <div class="row row_disable">
<div class="col-lg-9 float-md-right"> <div class="col-lg-9 float-md-right">
<div class="c_product_grid_details">
{% if all_oceny %}
<div class="c_product_grid_details"> {% for ocen_jed in all_oceny %}
{% if all_oceny %} <div class="c_product_item">
{% for ocen_jed in all_oceny %} <div class="row">
<div class="c_product_item"> <div class="col-lg-4 col-md-6">
<div class="row"> <strong> {{ocen_jed.ocena_jedn}} </strong>
</div>
<div class="col-lg-8 col-md-6">
<div class="c_product_text">
{{ocen_jed.comm}} {{ocen_jed.comm}}
{{ocen_jed.ocena_jedn}}
</div> </div>
</div>
</div> </div>
{% endfor %} </div>
{% else %} {% endfor %}
<p>No polls are available.</p> {% else %}
{% endif %} <p>No polls are available.</p>
</div> {% endif %}
</div> </div>
</div>
<form action="{% url 'enfilter' %}" method="post">
{% csrf_token %}
<input type="hidden" name="place" value="">
<input type="hidden" name="Oddam" value="">
<input type="hidden" name="Potrzebuje" value="">
</form>
</div> </div>
</div> <form action="{% url 'filter' %}" method="post">
{% csrf_token %}
<input type="hidden" name="place" value="">
<input type="hidden" name="Oddam" value="">
<input type="hidden" name="Potrzebuje" value="">
</form>
</div>
</div> </div>

View File

@ -191,13 +191,13 @@ def enadd_offer(request):
offer_local = request.POST['offer'] offer_local = request.POST['offer']
if title_local == "": if title_local == "":
messages.error(request,'Musisz podać tytuł!') messages.error(request,'Title cannot be empty!')
return redirect('add_offer') return redirect('add_offer')
if script_local == "": if script_local == "":
messages.error(request,'Musisz podać opis!') messages.error(request,'Description cannot be empty!')
return redirect('add_offer') return redirect('add_offer')
if place_local == "": if place_local == "":
messages.error(request,'Musisz podać miejscowość!') messages.error(request,'Locality cannot be empty!')
return redirect('add_offer') return redirect('add_offer')
product = Product( product = Product(
@ -213,7 +213,7 @@ def enadd_offer(request):
keywords = "", keywords = "",
) )
product.save() product.save()
messages.success(request, 'Ogłoszenie dodane!') messages.success(request, 'Offer added!')
return redirect(enmy_offer) return redirect(enmy_offer)
context = { context = {
'place_list': place_list, 'place_list': place_list,
@ -226,7 +226,7 @@ def endelete_offer(request, offer_id):
instance = Product.objects.get(id=offer_id) instance = Product.objects.get(id=offer_id)
instance.active = False instance.active = False
instance.save() instance.save()
messages.success(request, 'Ogłoszenie usunięte!') messages.success(request, 'Offer removed!')
return redirect(enmy_offer) return redirect(enmy_offer)
@ -254,13 +254,13 @@ def enedit_offer(request, offer_id):
wol = True wol = True
if title_local == "": if title_local == "":
messages.error(request,'Musisz podać tytuł!') messages.error(request,'Title cannot be empty!')
return redirect('add_offer') return redirect('add_offer')
if script_local == "": if script_local == "":
messages.error(request,'Musisz podać opis!') messages.error(request,'Description cannot be empty!')
return redirect('add_offer') return redirect('add_offer')
if place_local == "": if place_local == "":
messages.error(request,'Musisz podać miejscowość!') messages.error(request,'Locality cannot be empty!')
return redirect('add_offer') return redirect('add_offer')
if request.FILES: if request.FILES:
@ -278,7 +278,7 @@ def enedit_offer(request, offer_id):
instance.keywords = "" instance.keywords = ""
instance.save() instance.save()
messages.success(request, 'Ogłoszenie edytowane!') messages.success(request, 'Edited offer!')
return redirect(enmy_offer) return redirect(enmy_offer)
return render(request , 'enGB/edycja_ogloszenia.html', context) return render(request , 'enGB/edycja_ogloszenia.html', context)
@ -291,31 +291,31 @@ def encreate_user(request):
scales = request.POST['scales'] scales = request.POST['scales']
#walidacja #walidacja
if scales == "No": if scales == "No":
messages.error(request,'Musisz zaakceptować regulamin!') messages.error(request,'You must accept the Terms of use!')
return redirect('create_user') return redirect('create_user')
if email == "": if email == "":
messages.error(request,'Pole email jest puste!') messages.error(request,'The email field is empty!')
return redirect('create_user') return redirect('create_user')
if "@" not in email: if "@" not in email:
messages.error(request,'Wprowadzony email jest niepoprawny!') messages.error(request,'The entered email is invalid!')
return redirect('create_user') return redirect('create_user')
if User.objects.filter(email=email).exists(): if User.objects.filter(email=email).exists():
messages.error(request,'Ten adres e-mail jest już używany') messages.error(request,'This e-mail address is already in use')
return redirect('create_user') return redirect('create_user')
if password == "": if password == "":
messages.error(request,'Pole hasło jest puste!') messages.error(request,'The password field is empty!')
return redirect('create_user') return redirect('create_user')
if password != pow_password: if password != pow_password:
messages.error(request,'Podane hasła są różne') messages.error(request,'The passwords provided are different')
return redirect('create_user') return redirect('create_user')
if password == email: if password == email:
messages.error(request,'Podane hasła i email muszą byc różne') messages.error(request,'The password and email provided must be different')
return redirect('create_user') return redirect('create_user')
dlugosc = 0 dlugosc = 0
@ -336,7 +336,7 @@ def encreate_user(request):
dlugosc = 1 dlugosc = 1
if dlugosc+znak+mala+duza+cyfra != 5: if dlugosc+znak+mala+duza+cyfra != 5:
messages.error(request,'Podane hasło jest nieprawidłowe. Hasło musi zawierać conajmniej: 1 cyfre, 1 duza litere, 1 mala litere, 1 znak specjalny z zakresu !@#$%&*(){}[]<>?, oraz składać sie conajmniej z 8 symboli') messages.error(request,'The password provided is incorrect. The password must contain at least: 1 digit, 1 uppercase letter, 1 lowercase letter, 1 special character from the range! @ # $% & * () {} [] <>?, And must consist of at least 8 symbols')
return redirect('create_user') return redirect('create_user')
else: else:
@ -349,7 +349,7 @@ def encreate_user(request):
user.save() user.save()
user.set_password(password) user.set_password(password)
user.save() user.save()
messages.success(request,'Gratulacje, teraz możesz się zalogować!') messages.success(request,'Congratulations, you can login now!')
return redirect(enmy_offer) return redirect(enmy_offer)
return render(request , 'enGB/create_user.html') return render(request , 'enGB/create_user.html')
@ -365,7 +365,7 @@ def endelete_user(request):
offer.save() offer.save()
instant.save() instant.save()
messages.success(request,'Konto skasowane!') messages.success(request,'Account deleted!')
return redirect(enindex) return redirect(enindex)
def enedit_user(request): def enedit_user(request):
@ -378,7 +378,7 @@ def enedit_user(request):
newpassword2 = request.POST['newpassword2'] newpassword2 = request.POST['newpassword2']
user = authenticate(request, username=instant.username, password=oldpassword, is_active=True) user = authenticate(request, username=instant.username, password=oldpassword, is_active=True)
if user is None: if user is None:
messages.error(request,'Podałeś złe hasło') messages.error(request,'You entered the wrong password')
return redirect('edit_user') return redirect('edit_user')
dlugosc = 0 dlugosc = 0
@ -399,16 +399,16 @@ def enedit_user(request):
dlugosc = 1 dlugosc = 1
if dlugosc+znak+mala+duza+cyfra != 5: if dlugosc+znak+mala+duza+cyfra != 5:
messages.error(request,'Podane hasło jest nieprawidłowe. Hasło musi zawierać conajmniej: 1 cyfre, 1 duza litere, 1 mala litere, 1 znak specjalny z zakresu !@#$%&*(){}[]<>?, oraz składać sie conajmniej z 8 symboli') messages.error(request,'Podane hasło jest nieprawidłowe. Hasło musi najmniejsze: 1 cyfra, 1 duza litere, 1 mala litere, 1 znak specjalny z zakresu! @ # $% & * () {} [] <> ?, oraz składać sie conajmniej z 8 symboli')
return redirect('edit_user') return redirect('edit_user')
if newpassword1 != newpassword2: if newpassword1 != newpassword2:
messages.error(request,'Podane nowe hasła są różne') messages.error(request,'The new passwords provided are different')
return redirect('edit_user') return redirect('edit_user')
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,'Password changed, you are logged out!')
return redirect('enmy_offer') return redirect('enmy_offer')
return render(request , 'enGB/edit_user.html') return render(request , 'enGB/edit_user.html')
@ -420,16 +420,16 @@ def enlogin(request):
user = authenticate(request, username=username, password=password, is_active=True) user = authenticate(request, username=username, password=password, is_active=True)
if user is not None: if user is not None:
auth.login(request,user) auth.login(request,user)
messages.success(request, 'Jesteś zalogowany!') messages.success(request, 'You are logged in!')
return redirect(enmy_offer) return redirect(enmy_offer)
else: else:
messages.error(request,'Nieprawidłowe dane logowania!') messages.error(request,'Invalid login details!')
return redirect(enlogin) return redirect(enlogin)
return render(request , 'enGB/enlogin.html') return render(request , 'enGB/enlogin.html')
def enlogout_user(request): def enlogout_user(request):
auth.logout(request) auth.logout(request)
messages.success(request, 'Zostałeś wylogowany!') messages.success(request, 'You have been logged out!')
return redirect(enindex) return redirect(enindex)
def enuser_profile(request, user_name): def enuser_profile(request, user_name):
@ -479,7 +479,7 @@ def enadd_comment(request, user_name):
ocena_jedn = int(volume_local)*2, ocena_jedn = int(volume_local)*2,
) )
instant.save() instant.save()
messages.success(request, 'Dodano komentarz') messages.success(request, 'Comment added')
return redirect(enuser_profile, user_name) return redirect(enuser_profile, user_name)
context = { context = {

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

@ -3,217 +3,210 @@
{% block content %} {% block content %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<body>
<body> <!--================Categories Banner Area =================-->
<!--================Categories Banner Area =================-->
<section class="solid_banner_area">
<div class="container">
<div class="solid_banner_inner">
<h3>Profil użytkownika</h3>
<h5>{{ name }}</h5>
<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>
{% if user.email %}
<p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Oceń Użytkownika</button></a>
{% endif %}
</div>
</div>
</section>
<!--================End Categories Banner Area =================-->
<!--================Categories Product Area =================--> <section class="solid_banner_area">
<div class="container">
<div class="solid_banner_inner">
<h3>Profil użytkownika</h3>
<h5>{{ name }}</h5>
<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>
{% if user.email %}
<p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Oceń Użytkownika</button></a>
{% endif %}
</div>
</div>
</section>
<!--================End Categories Banner Area =================-->
<section class="categories_product_main p_80"> <!--================Categories Product Area =================-->
<div class="container">
<ul class="nav nav-tabs" role="tablist"> <section class="categories_product_main p_80">
<li class="nav-item"> <div class="container">
<a class="nav-link active" href="#1zakladka" role="tab" data-toggle="tab">Produkty</a> <ul class="nav nav-tabs" role="tablist">
</li> <li class="nav-item">
<li class="nav-item"> <a class="nav-link active" href="#1zakladka" role="tab" data-toggle="tab">Produkty</a>
<a class="nav-link" href="#2zakladka" role="tab" data-toggle="tab">Oceny</a> </li>
</li> <li class="nav-item">
</ul> <a class="nav-link" href="#2zakladka" role="tab" data-toggle="tab">Oceny</a>
</li>
<div class="tab-content"> </ul>
<div class="tab-pane active" id="1zakladka"> <div class="tab-content">
<div class="tab-pane active" id="1zakladka">
<div class="categories_main_inner"> <div class="categories_main_inner">
<div class="row row_disable"> <div class="row row_disable">
<div class="col-lg-9 float-md-right"> <div class="col-lg-9 float-md-right">
<div class="c_product_grid_details">
{% if all_product %}
<div class="c_product_grid_details"> {% for product in all_product %}
{% if all_product %} <div class="c_product_item">
{% for product in all_product %} <div class="row">
<div class="c_product_item"> <div class="col-lg-4 col-md-6">
<div class="row"> <div class="c_product_img">
<div class="col-lg-4 col-md-6"> <img class="img-fluid" src="{{ product.picture.url }}">
<div class="c_product_img">
<img class="img-fluid" src="{{ product.picture.url }}">
</div>
</div>
<div class="col-lg-8 col-md-6">
<div class="c_product_text">
<h1>{{ product.title }}</h1>
{% if types.0.0 == product.type %}
<h5>Potrzebuje
{% else %}
<h5>Oddam
{% endif %}
{% if types_o.0.0 == product.offer %}
Usługa</h5>
{% else %}
Przedmiot</h5>
{% endif %}
<h6>Z miejscowości: <span>{{ product.place }}</span></h6>
<p>{{ product.description }}</p>
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<p>No polls are available.</p>
{% endif %}
</div> </div>
</div>
<form action="{% url 'filter' %}" method="post">
{% csrf_token %}
<input type="hidden" name="place" value="">
<input type="hidden" name="Oddam" value="">
<input type="hidden" name="Potrzebuje" value="">
</form>
</div>
</div>
</div>
<div class="tab-pane" id="2zakladka">
<div class="categories_main_inner">
<div class="row row_disable">
<div class="col-lg-9 float-md-right">
<div class="c_product_grid_details">
{% if all_oceny %}
{% for ocen_jed in all_oceny %}
<div class="c_product_item">
<div class="row">
{{ocen_jed.comm}}
{{ocen_jed.ocena_jedn}}
</div>
</div>
{% endfor %}
{% else %}
<p>No polls are available.</p>
{% endif %}
</div> </div>
<div class="col-lg-8 col-md-6">
<div class="c_product_text">
<h1>{{ product.title }}</h1>
{% if types.0.0 == product.type %}
<h5>Potrzebuje
{% else %}
<h5>Oddam
{% endif %}
{% if types_o.0.0 == product.offer %}
Usługa</h5>
{% else %}
Przedmiot</h5>
{% endif %}
<h6>Z miejscowości: <span>{{ product.place }}</span></h6>
<p>{{ product.description }}</p>
</div>
</div>
</div>
</div> </div>
{% endfor %}
<form action="{% url 'filter' %}" method="post"> {% else %}
{% csrf_token %} <p>No polls are available.</p>
{% endif %}
<input type="hidden" name="place" value="">
<input type="hidden" name="Oddam" value="">
<input type="hidden" name="Potrzebuje" value="">
</form>
</div>
</div>
</div>
</div></div>
</section>
<!--================End Categories Product Area =================-->
<!--================Footer Area =================-->
<footer class="footer_area">
<div class="container">
<div class="footer_widgets">
<div class="row">
<div class="col-lg-4 col-md-4 col-6">
<aside class="f_widget f_about_widget">
<img src="img/logo.png" alt="">
<p>Persuit is a Premium PSD Template. Best choice for your online store. Let purchase it to enjoy now</p>
<h6>Social:</h6>
<ul>
<li><a href="#"><i class="social_facebook"></i></a></li>
<li><a href="#"><i class="social_twitter"></i></a></li>
<li><a href="#"><i class="social_pinterest"></i></a></li>
<li><a href="#"><i class="social_instagram"></i></a></li>
<li><a href="#"><i class="social_youtube"></i></a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_info_widget">
<div class="f_w_title">
<h3>Information</h3>
</div>
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">Delivery information</a></li>
<li><a href="#">Terms & Conditions</a></li>
<li><a href="#">Help Center</a></li>
<li><a href="#">Returns & Refunds</a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_service_widget">
<div class="f_w_title">
<h3>Customer Service</h3>
</div>
<ul>
<li><a href="#">My account</a></li>
<li><a href="#">Ordr History</a></li>
<li><a href="#">Wish List</a></li>
<li><a href="#">Newsletter</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_extra_widget">
<div class="f_w_title">
<h3>Extras</h3>
</div>
<ul>
<li><a href="#">Brands</a></li>
<li><a href="#">Gift Vouchers</a></li>
<li><a href="#">Affiliates</a></li>
<li><a href="#">Specials</a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_account_widget">
<div class="f_w_title">
<h3>My Account</h3>
</div>
<ul>
<li><a href="#">My account</a></li>
<li><a href="#">Ordr History</a></li>
<li><a href="#">Wish List</a></li>
<li><a href="#">Newsletter</a></li>
</ul>
</aside>
</div>
</div>
</div>
<div class="footer_copyright">
<h5>© <script>document.write(new Date().getFullYear());</script> <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy;<script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a>. Downloaded from <a href="https://themeslab.org/" target="_blank">Themeslab</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</h5>
</div> </div>
</div>
<form action="{% url 'filter' %}" method="post">
{% csrf_token %}
<input type="hidden" name="place" value="">
<input type="hidden" name="Oddam" value="">
<input type="hidden" name="Potrzebuje" value="">
</form>
</div> </div>
</footer> </div>
<!--================End Footer Area =================--> </div>
</body> <div class="tab-pane" id="2zakladka">
<div class="categories_main_inner">
<div class="row row_disable">
<div class="col-lg-9 float-md-right">
<div class="c_product_grid_details">
{% if all_oceny %}
{% for ocen_jed in all_oceny %}
<div class="c_product_item">
<div class="row">
<div class="col-lg-4 col-md-6">
<strong> {{ocen_jed.ocena_jedn}} </strong>
</div>
<div class="col-lg-8 col-md-6">
<div class="c_product_text">
{{ocen_jed.comm}}
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<p>No polls are available.</p>
{% endif %}
</div>
</div>
</div>
<form action="{% url 'filter' %}" method="post">
{% csrf_token %}
<input type="hidden" name="place" value="">
<input type="hidden" name="Oddam" value="">
<input type="hidden" name="Potrzebuje" value="">
</form>
</div>
</div>
</div>
</div>
</section>
<!--================End Categories Product Area =================-->
<!--================Footer Area =================-->
<footer class="footer_area">
<div class="container">
<div class="footer_widgets">
<div class="row">
<div class="col-lg-4 col-md-4 col-6">
<aside class="f_widget f_about_widget">
<img src="img/logo.png" alt="">
<p>Persuit is a Premium PSD Template. Best choice for your online store. Let purchase it to enjoy now</p>
<h6>Social:</h6>
<ul>
<li><a href="#"><i class="social_facebook"></i></a></li>
<li><a href="#"><i class="social_twitter"></i></a></li>
<li><a href="#"><i class="social_pinterest"></i></a></li>
<li><a href="#"><i class="social_instagram"></i></a></li>
<li><a href="#"><i class="social_youtube"></i></a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_info_widget">
<div class="f_w_title">
<h3>Information</h3>
</div>
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">Delivery information</a></li>
<li><a href="#">Terms & Conditions</a></li>
<li><a href="#">Help Center</a></li>
<li><a href="#">Returns & Refunds</a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_service_widget">
<div class="f_w_title">
<h3>Customer Service</h3>
</div>
<ul>
<li><a href="#">My account</a></li>
<li><a href="#">Ordr History</a></li>
<li><a href="#">Wish List</a></li>
<li><a href="#">Newsletter</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_extra_widget">
<div class="f_w_title">
<h3>Extras</h3>
</div>
<ul>
<li><a href="#">Brands</a></li>
<li><a href="#">Gift Vouchers</a></li>
<li><a href="#">Affiliates</a></li>
<li><a href="#">Specials</a></li>
</ul>
</aside>
</div>
<div class="col-lg-2 col-md-4 col-6">
<aside class="f_widget link_widget f_account_widget">
<div class="f_w_title">
<h3>My Account</h3>
</div>
<ul>
<li><a href="#">My account</a></li>
<li><a href="#">Ordr History</a></li>
<li><a href="#">Wish List</a></li>
<li><a href="#">Newsletter</a></li>
</ul>
</aside>
</div>
</div>
</div>
<div class="footer_copyright">
<h5>© <script>document.write(new Date().getFullYear());</script> <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy;<script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a>. Downloaded from <a href="https://themeslab.org/" target="_blank">Themeslab</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</h5>
</div>
</div>
</footer>
<!--================End Footer Area =================-->
</body>
</html> </html>
{% endblock %} {% endblock %}