This commit is contained in:
Jędrzej Klepacki 2021-01-07 19:56:07 +01:00
parent 4f6fcbdbb0
commit 5b66859a59
26 changed files with 162 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

View File

@ -10,10 +10,60 @@
<div class="container"> <div class="container">
<div class="solid_banner_inner"> <div class="solid_banner_inner">
<h3>User Profile</h3> <h3>User Profile</h3>
<h5>{{ name }}</h5> <h5>{{ name }}</h5><p><br></p>
<label>Neutral</label><br> <p><SPAN STYLE="font-size:16.0pt">Average Grade: <strong>{{ocena}}</SPAN></strong></p>
<label style="color:red">Negative</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">Positive</label> <strong> 0
{% if user.email %} <img src="{% static "color\ff0000.png"%}" height="20" width="30"/>
{% if ocena > 9 %}
<img src="{% static "color\ff3200.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 19 %}
<img src="{% static "color\ff6400.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 29 %}
<img src="{% static "color\ff9600.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 39 %}
<img src="{% static "color\ffc800.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 49 %}
<img src="{% static "color\ffff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 59 %}
<img src="{% static "color\c8ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 69 %}
<img src="{% static "color\96ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 79 %}
<img src="{% static "color\64ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 89 %}
<img src="{% static "color\32ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 99 %}
<img src="{% static "color\00ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %} 100 </strong>{% if user.email %}
<p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Rate User</button></a> <p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Rate User</button></a>
{% endif %} {% endif %}
</div> </div>

View File

@ -152,7 +152,6 @@ def enfilter(request):
types = TYPE_T types = TYPE_T
types_o = TYPE_O types_o = TYPE_O
print(types)
context = { context = {
'all_product': all_product, 'all_product': all_product,
'types': types, 'types': types,
@ -450,7 +449,6 @@ def enuser_profile(request, user_name):
ocena = 0 ocena = 0
suma = 0 suma = 0
for ocena_j in oceny: for ocena_j in oceny:
print(ocena)
ocena = ocena + ocena_j.ocena_jedn ocena = ocena + ocena_j.ocena_jedn
suma = suma + 1 suma = suma + 1
ocena = ocena / suma ocena = ocena / suma

View File

@ -1,6 +1,7 @@
from django.contrib import admin from django.contrib import admin
from .models import Product, Places, Ocena from .models import Product, Places, Ocena, chat
admin.site.register(Product) admin.site.register(Product)
admin.site.register(Places) admin.site.register(Places)
admin.site.register(Ocena) admin.site.register(Ocena)
admin.site.register(chat)

View File

@ -0,0 +1,14 @@
# Generated by Django 3.1.4 on 2021-01-07 16:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_auto_20210103_1424'),
('homepage', '0002_auto_20210103_1457'),
]
operations = [
]

View File

@ -0,0 +1,27 @@
# Generated by Django 3.1.4 on 2021-01-07 16:40
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('homepage', '0003_merge_20210107_1740'),
]
operations = [
migrations.CreateModel(
name='chat',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sec_user_id', models.IntegerField(default='')),
('text', models.TextField(default='', max_length=5000)),
('pub_date', models.DateTimeField(verbose_name='date published')),
('author_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('product_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.product')),
],
),
]

View File

@ -34,3 +34,10 @@ class Ocena(models.Model):
user_iden = models.ForeignKey(User, on_delete=models.CASCADE) user_iden = models.ForeignKey(User, on_delete=models.CASCADE)
comm = models.TextField(max_length=40, blank=False, default="") comm = models.TextField(max_length=40, blank=False, default="")
ocena_jedn = models.FloatField(max_length=40, blank=False, default="") ocena_jedn = models.FloatField(max_length=40, blank=False, default="")
class chat(models.Model):
product_id = models.ForeignKey(Product, on_delete=models.CASCADE)
author_id = models.ForeignKey(User, on_delete=models.CASCADE)
sec_user_id = models.IntegerField(blank=False, default="")
text = models.TextField(max_length=5000, blank=False, default="")
pub_date = models.DateTimeField('date published')

View File

@ -11,12 +11,63 @@
<div class="container"> <div class="container">
<div class="solid_banner_inner"> <div class="solid_banner_inner">
<h3>Profil użytkownika</h3> <h3>Profil użytkownika</h3>
<h5>{{ name }}</h5> <h5>{{ name }}</h5><p><br></p>
<label>Neutralne</label><br> <p><SPAN STYLE="font-size:16.0pt">Średnia Ocena: <strong>{{ocena}}</SPAN></strong></p>
<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> <strong> 0
{% if user.email %} <img src="{% static "color\ff0000.png"%}" height="20" width="30"/>
<p></p><a href="{{ name }}/add_comment"><button type="button" class="btn btn-primary pull-right">Oceń Użytkownika</button></a> {% if ocena > 9 %}
{% endif %} <img src="{% static "color\ff3200.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 19 %}
<img src="{% static "color\ff6400.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 29 %}
<img src="{% static "color\ff9600.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 39 %}
<img src="{% static "color\ffc800.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 49 %}
<img src="{% static "color\ffff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 59 %}
<img src="{% static "color\c8ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 69 %}
<img src="{% static "color\96ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 79 %}
<img src="{% static "color\64ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 89 %}
<img src="{% static "color\32ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %}
{% if ocena > 99 %}
<img src="{% static "color\00ff00.png"%}" height="20" width="30"/>
{% else %}
<img src="{% static "color\C0C0C0.png"%}" height="20" width="30"/>
{% endif %} 100 </strong>
{% 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>
</div> </div>
</section> </section>

View File

@ -7,7 +7,7 @@ from django.template import loader
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib import messages, auth from django.contrib import messages, auth
from .models import Product, TYPE_T, TYPE_O, Places, Ocena from .models import Product, TYPE_T, TYPE_O, Places, Ocena, chat
from django.utils import timezone from django.utils import timezone
from datetime import timedelta from datetime import timedelta
@ -152,7 +152,6 @@ def filter(request):
types = TYPE_T types = TYPE_T
types_o = TYPE_O types_o = TYPE_O
print(types)
context = { context = {
'all_product': all_product, 'all_product': all_product,
'types': types, 'types': types,
@ -450,7 +449,6 @@ def user_profile(request, user_name):
ocena = 0 ocena = 0
suma = 0 suma = 0
for ocena_j in oceny: for ocena_j in oceny:
print(ocena)
ocena = ocena + ocena_j.ocena_jedn ocena = ocena + ocena_j.ocena_jedn
suma = suma + 1 suma = suma + 1
ocena = ocena / suma ocena = ocena / suma