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="solid_banner_inner">
<h3>User Profile</h3>
<h5>{{ name }}</h5>
<label>Neutral</label><br>
<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>
{% if user.email %}
<h5>{{ name }}</h5><p><br></p>
<p><SPAN STYLE="font-size:16.0pt">Average Grade: <strong>{{ocena}}</SPAN></strong></p>
<strong> 0
<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>
{% endif %}
</div>

View File

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

View File

@ -1,6 +1,7 @@
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(Places)
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)
comm = models.TextField(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="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 %}
<h5>{{ name }}</h5><p><br></p>
<p><SPAN STYLE="font-size:16.0pt">Średnia Ocena: <strong>{{ocena}}</SPAN></strong></p>
<strong> 0
<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">Oceń Użytkownika</button></a>
{% endif %}
</div>
</div>
</section>

View File

@ -7,7 +7,7 @@ from django.template import loader
from django.contrib.auth import get_user_model
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 datetime import timedelta
@ -152,7 +152,6 @@ def filter(request):
types = TYPE_T
types_o = TYPE_O
print(types)
context = {
'all_product': all_product,
'types': types,
@ -450,7 +449,6 @@ def user_profile(request, user_name):
ocena = 0
suma = 0
for ocena_j in oceny:
print(ocena)
ocena = ocena + ocena_j.ocena_jedn
suma = suma + 1
ocena = ocena / suma