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

@ -95,15 +95,19 @@
<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}}
{{ocen_jed.ocena_jedn}}
</div>
</div>
</div>
</div>
{% endfor %}
@ -112,10 +116,9 @@
{% endif %}
</div>
</div>
<form action="{% url 'enfilter' %}" method="post">
</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="">
@ -123,8 +126,6 @@
</div>
</div>
</div>
</div></div>
</section>

View File

@ -191,13 +191,13 @@ def enadd_offer(request):
offer_local = request.POST['offer']
if title_local == "":
messages.error(request,'Musisz podać tytuł!')
messages.error(request,'Title cannot be empty!')
return redirect('add_offer')
if script_local == "":
messages.error(request,'Musisz podać opis!')
messages.error(request,'Description cannot be empty!')
return redirect('add_offer')
if place_local == "":
messages.error(request,'Musisz podać miejscowość!')
messages.error(request,'Locality cannot be empty!')
return redirect('add_offer')
product = Product(
@ -213,7 +213,7 @@ def enadd_offer(request):
keywords = "",
)
product.save()
messages.success(request, 'Ogłoszenie dodane!')
messages.success(request, 'Offer added!')
return redirect(enmy_offer)
context = {
'place_list': place_list,
@ -226,7 +226,7 @@ def endelete_offer(request, offer_id):
instance = Product.objects.get(id=offer_id)
instance.active = False
instance.save()
messages.success(request, 'Ogłoszenie usunięte!')
messages.success(request, 'Offer removed!')
return redirect(enmy_offer)
@ -254,13 +254,13 @@ def enedit_offer(request, offer_id):
wol = True
if title_local == "":
messages.error(request,'Musisz podać tytuł!')
messages.error(request,'Title cannot be empty!')
return redirect('add_offer')
if script_local == "":
messages.error(request,'Musisz podać opis!')
messages.error(request,'Description cannot be empty!')
return redirect('add_offer')
if place_local == "":
messages.error(request,'Musisz podać miejscowość!')
messages.error(request,'Locality cannot be empty!')
return redirect('add_offer')
if request.FILES:
@ -278,7 +278,7 @@ def enedit_offer(request, offer_id):
instance.keywords = ""
instance.save()
messages.success(request, 'Ogłoszenie edytowane!')
messages.success(request, 'Edited offer!')
return redirect(enmy_offer)
return render(request , 'enGB/edycja_ogloszenia.html', context)
@ -291,31 +291,31 @@ def encreate_user(request):
scales = request.POST['scales']
#walidacja
if scales == "No":
messages.error(request,'Musisz zaakceptować regulamin!')
messages.error(request,'You must accept the Terms of use!')
return redirect('create_user')
if email == "":
messages.error(request,'Pole email jest puste!')
messages.error(request,'The email field is empty!')
return redirect('create_user')
if "@" not in email:
messages.error(request,'Wprowadzony email jest niepoprawny!')
messages.error(request,'The entered email is invalid!')
return redirect('create_user')
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')
if password == "":
messages.error(request,'Pole hasło jest puste!')
messages.error(request,'The password field is empty!')
return redirect('create_user')
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')
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')
dlugosc = 0
@ -336,7 +336,7 @@ def encreate_user(request):
dlugosc = 1
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')
else:
@ -349,7 +349,7 @@ def encreate_user(request):
user.save()
user.set_password(password)
user.save()
messages.success(request,'Gratulacje, teraz możesz się zalogować!')
messages.success(request,'Congratulations, you can login now!')
return redirect(enmy_offer)
return render(request , 'enGB/create_user.html')
@ -365,7 +365,7 @@ def endelete_user(request):
offer.save()
instant.save()
messages.success(request,'Konto skasowane!')
messages.success(request,'Account deleted!')
return redirect(enindex)
def enedit_user(request):
@ -378,7 +378,7 @@ def enedit_user(request):
newpassword2 = request.POST['newpassword2']
user = authenticate(request, username=instant.username, password=oldpassword, is_active=True)
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')
dlugosc = 0
@ -399,16 +399,16 @@ def enedit_user(request):
dlugosc = 1
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')
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')
instant.set_password(newpassword1)
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 render(request , 'enGB/edit_user.html')
@ -420,16 +420,16 @@ def enlogin(request):
user = authenticate(request, username=username, password=password, is_active=True)
if user is not None:
auth.login(request,user)
messages.success(request, 'Jesteś zalogowany!')
messages.success(request, 'You are logged in!')
return redirect(enmy_offer)
else:
messages.error(request,'Nieprawidłowe dane logowania!')
messages.error(request,'Invalid login details!')
return redirect(enlogin)
return render(request , 'enGB/enlogin.html')
def enlogout_user(request):
auth.logout(request)
messages.success(request, 'Zostałeś wylogowany!')
messages.success(request, 'You have been logged out!')
return redirect(enindex)
def enuser_profile(request, user_name):
@ -479,7 +479,7 @@ def enadd_comment(request, user_name):
ocena_jedn = int(volume_local)*2,
)
instant.save()
messages.success(request, 'Dodano komentarz')
messages.success(request, 'Comment added')
return redirect(enuser_profile, user_name)
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,9 +3,10 @@
{% block content %}
<!DOCTYPE html>
<html lang="en">
<body>
<!--================Categories Banner Area =================-->
<section class="solid_banner_area">
<div class="container">
<div class="solid_banner_inner">
@ -19,14 +20,13 @@
</div>
</div>
</section>
<!--================End Categories Banner Area =================-->
<!--================Categories Product Area =================-->
<section class="categories_product_main p_80">
<div class="container">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" href="#1zakladka" role="tab" data-toggle="tab">Produkty</a>
@ -35,15 +35,11 @@
<a class="nav-link" href="#2zakladka" role="tab" data-toggle="tab">Oceny</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="1zakladka">
<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_product %}
{% for product in all_product %}
@ -79,31 +75,32 @@
{% endif %}
</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">
<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}}
{{ocen_jed.ocena_jedn}}
</div>
</div>
</div>
</div>
{% endfor %}
@ -112,21 +109,17 @@
{% 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></div>
</div>
</section>
<!--================End Categories Product Area =================-->