This commit is contained in:
Jędrzej Klepacki 2021-01-11 17:13:05 +01:00
parent 2454ab21ae
commit 35b36b3300
7 changed files with 47 additions and 7 deletions

View File

@ -79,7 +79,7 @@ WSGI_APPLICATION = 'SocialHelper.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql', 'ENGINE': 'django.db.backends.postgresql',
'NAME': 'socialhelperdb2', 'NAME': 'socialhelperdb',
'USER': 'postgres', 'USER': 'postgres',
'PASSWORD': 'admin', 'PASSWORD': 'admin',
'HOST': 'localhost' 'HOST': 'localhost'

View File

@ -6,7 +6,19 @@
<body> <body>
<style>
a:link {
color: black;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: blue;
background-color: transparent;
text-decoration: underline;
}
</style>
<!--================Categories Product Area =================--> <!--================Categories Product Area =================-->
<section class="categories_product_main p_80"> <section class="categories_product_main p_80">

View File

@ -14,6 +14,19 @@
</div> </div>
</div> </div>
</section> </section>
<style>
a:link {
color: black;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: blue;
background-color: transparent;
text-decoration: underline;
}
</style>
<!--================End Categories Banner Area =================--> <!--================End Categories Banner Area =================-->
<!--================Categories Product Area =================--> <!--================Categories Product Area =================-->
@ -40,7 +53,7 @@
</div> </div>
<div class="col-lg-8 col-md-6"> <div class="col-lg-8 col-md-6">
<div class="c_product_text"> <div class="c_product_text">
<h1>{{ product.title }}</h1> <a href="/homepage/offer_details/{{ product.id }}"><h1>{{ product.title }}</h1></a>
{% if types.0.0 == product.type %} {% if types.0.0 == product.type %}
<h5>Potrzebuje <h5>Potrzebuje
{% else %} {% else %}

View File

@ -4,6 +4,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<body> <body>
<style>
a:link {
color: black;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: blue;
background-color: transparent;
text-decoration: underline;
}
</style>
<!--================Categories Banner Area =================--> <!--================Categories Banner Area =================-->
@ -12,7 +25,6 @@
<div class="solid_banner_inner"> <div class="solid_banner_inner">
<h3>Profil użytkownika</h3> <h3>Profil użytkownika</h3>
<h5>{{ name }}</h5><p><br></p> <h5>{{ name }}</h5><p><br></p>
<p><SPAN STYLE="font-size:16.0pt">Ilość ocen: <strong>{{suma_ocen}}</SPAN></strong></p>
<p><SPAN STYLE="font-size:16.0pt">Średnia Ocena: <strong>{{ocena_2}}</SPAN></strong></p> <p><SPAN STYLE="font-size:16.0pt">Średnia Ocena: <strong>{{ocena_2}}</SPAN></strong></p>
<strong> 1 <strong> 1
<img src="{% static "color\ff0000.png"%}" height="20" width="30"/> <img src="{% static "color\ff0000.png"%}" height="20" width="30"/>
@ -81,10 +93,10 @@
<div class="container"> <div class="container">
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<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 active" href="#1zakladka" role="tab" data-toggle="tab">Produkty ({{suma_prod}})</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#2zakladka" role="tab" data-toggle="tab">Oceny</a> <a class="nav-link" href="#2zakladka" role="tab" data-toggle="tab">Oceny ({{suma_oc}})</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
@ -108,7 +120,7 @@
</div> </div>
<div class="col-lg-8 col-md-6"> <div class="col-lg-8 col-md-6">
<div class="c_product_text"> <div class="c_product_text">
<h1>{{ product.title }}</h1> <a href="/homepage/offer_details/{{ product.id }}"><h1>{{ product.title }}</h1></a>
{% if types.0.0 == product.type %} {% if types.0.0 == product.type %}
<h5>Potrzebuje <h5>Potrzebuje
{% else %} {% else %}

View File

@ -441,6 +441,7 @@ def user_profile(request, user_name):
user_prof = User.objects.filter(email=user_name).first() 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)
suma_prod = all_product.count()
oceny = Ocena.objects.filter(user_iden = user_prof.id) oceny = Ocena.objects.filter(user_iden = user_prof.id)
template = loader.get_template('homepage/user_profile.html') template = loader.get_template('homepage/user_profile.html')
@ -458,6 +459,7 @@ def user_profile(request, user_name):
ocena = int (ocena) ocena = int (ocena)
else: else:
ocena = 50 ocena = 50
suma_oc = 0
ocena_2 = ocena/10 ocena_2 = ocena/10
context = { context = {
'all_product': all_product, 'all_product': all_product,
@ -465,7 +467,8 @@ def user_profile(request, user_name):
'ocena': ocena, 'ocena': ocena,
'name': user_prof.email, 'name': user_prof.email,
'ocena_2': ocena_2, 'ocena_2': ocena_2,
'suma_ocen': suma, #suma wszystkich ocen uzytkownika 'suma_oc': suma, #suma wszystkich ocen uzytkownika
'suma_prod': suma_prod,
} }
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))