diff --git a/SocialHelper/SocialHelper/static/color/00ff00.png b/SocialHelper/SocialHelper/static/color/00ff00.png new file mode 100644 index 0000000..46079c1 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/00ff00.png differ diff --git a/SocialHelper/SocialHelper/static/color/32ff00.png b/SocialHelper/SocialHelper/static/color/32ff00.png new file mode 100644 index 0000000..0bff2d2 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/32ff00.png differ diff --git a/SocialHelper/SocialHelper/static/color/64ff00.png b/SocialHelper/SocialHelper/static/color/64ff00.png new file mode 100644 index 0000000..4900855 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/64ff00.png differ diff --git a/SocialHelper/SocialHelper/static/color/96ff00.png b/SocialHelper/SocialHelper/static/color/96ff00.png new file mode 100644 index 0000000..4511f0d Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/96ff00.png differ diff --git a/SocialHelper/SocialHelper/static/color/c0c0c0.png b/SocialHelper/SocialHelper/static/color/c0c0c0.png new file mode 100644 index 0000000..28f921a Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/c0c0c0.png differ diff --git a/SocialHelper/SocialHelper/static/color/c8ff00.png b/SocialHelper/SocialHelper/static/color/c8ff00.png new file mode 100644 index 0000000..aaff375 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/c8ff00.png differ diff --git a/SocialHelper/SocialHelper/static/color/ff0000.png b/SocialHelper/SocialHelper/static/color/ff0000.png new file mode 100644 index 0000000..de12154 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/ff0000.png differ diff --git a/SocialHelper/SocialHelper/static/color/ff3200.png b/SocialHelper/SocialHelper/static/color/ff3200.png new file mode 100644 index 0000000..e47d018 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/ff3200.png differ diff --git a/SocialHelper/SocialHelper/static/color/ff6400.png b/SocialHelper/SocialHelper/static/color/ff6400.png new file mode 100644 index 0000000..eae2924 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/ff6400.png differ diff --git a/SocialHelper/SocialHelper/static/color/ff9600.png b/SocialHelper/SocialHelper/static/color/ff9600.png new file mode 100644 index 0000000..62d34ec Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/ff9600.png differ diff --git a/SocialHelper/SocialHelper/static/color/ffc800.png b/SocialHelper/SocialHelper/static/color/ffc800.png new file mode 100644 index 0000000..b37ff4d Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/ffc800.png differ diff --git a/SocialHelper/SocialHelper/static/color/ffff00.png b/SocialHelper/SocialHelper/static/color/ffff00.png new file mode 100644 index 0000000..04964b6 Binary files /dev/null and b/SocialHelper/SocialHelper/static/color/ffff00.png differ diff --git a/SocialHelper/enGB/__pycache__/views.cpython-37.pyc b/SocialHelper/enGB/__pycache__/views.cpython-37.pyc index 187bb25..1bde51e 100644 Binary files a/SocialHelper/enGB/__pycache__/views.cpython-37.pyc and b/SocialHelper/enGB/__pycache__/views.cpython-37.pyc differ diff --git a/SocialHelper/enGB/templates/enGB/user_profile.html b/SocialHelper/enGB/templates/enGB/user_profile.html index b236ac9..bf4e184 100644 --- a/SocialHelper/enGB/templates/enGB/user_profile.html +++ b/SocialHelper/enGB/templates/enGB/user_profile.html @@ -10,10 +10,60 @@

User Profile

-
{{ name }}
-
- - {% if user.email %} +
{{ name }}


+

Average Grade: {{ocena}}

+ 0 + + {% if ocena > 9 %} + + {% else %} + + {% endif %} + {% if ocena > 19 %} + + {% else %} + + {% endif %} + {% if ocena > 29 %} + + {% else %} + + {% endif %} + {% if ocena > 39 %} + + {% else %} + + {% endif %} + {% if ocena > 49 %} + + {% else %} + + {% endif %} + {% if ocena > 59 %} + + {% else %} + + {% endif %} + {% if ocena > 69 %} + + {% else %} + + {% endif %} + {% if ocena > 79 %} + + {% else %} + + {% endif %} + {% if ocena > 89 %} + + {% else %} + + {% endif %} + {% if ocena > 99 %} + + {% else %} + + {% endif %} 100 {% if user.email %}

{% endif %}
diff --git a/SocialHelper/enGB/views.py b/SocialHelper/enGB/views.py index cf03e2a..b694d2e 100644 --- a/SocialHelper/enGB/views.py +++ b/SocialHelper/enGB/views.py @@ -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 diff --git a/SocialHelper/homepage/__pycache__/admin.cpython-37.pyc b/SocialHelper/homepage/__pycache__/admin.cpython-37.pyc index c18d539..9b3b46f 100644 Binary files a/SocialHelper/homepage/__pycache__/admin.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/admin.cpython-37.pyc differ diff --git a/SocialHelper/homepage/__pycache__/models.cpython-37.pyc b/SocialHelper/homepage/__pycache__/models.cpython-37.pyc index c5c4a0e..e669f25 100644 Binary files a/SocialHelper/homepage/__pycache__/models.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/models.cpython-37.pyc differ diff --git a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc index 94e5cfb..753de09 100644 Binary files a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc differ diff --git a/SocialHelper/homepage/admin.py b/SocialHelper/homepage/admin.py index 32076e1..e5e4db8 100644 --- a/SocialHelper/homepage/admin.py +++ b/SocialHelper/homepage/admin.py @@ -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) diff --git a/SocialHelper/homepage/migrations/0003_merge_20210107_1740.py b/SocialHelper/homepage/migrations/0003_merge_20210107_1740.py new file mode 100644 index 0000000..16fc841 --- /dev/null +++ b/SocialHelper/homepage/migrations/0003_merge_20210107_1740.py @@ -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 = [ + ] diff --git a/SocialHelper/homepage/migrations/0004_chat.py b/SocialHelper/homepage/migrations/0004_chat.py new file mode 100644 index 0000000..02c26a0 --- /dev/null +++ b/SocialHelper/homepage/migrations/0004_chat.py @@ -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')), + ], + ), + ] diff --git a/SocialHelper/homepage/migrations/__pycache__/0003_merge_20210107_1740.cpython-37.pyc b/SocialHelper/homepage/migrations/__pycache__/0003_merge_20210107_1740.cpython-37.pyc new file mode 100644 index 0000000..287d9d8 Binary files /dev/null and b/SocialHelper/homepage/migrations/__pycache__/0003_merge_20210107_1740.cpython-37.pyc differ diff --git a/SocialHelper/homepage/migrations/__pycache__/0004_chat.cpython-37.pyc b/SocialHelper/homepage/migrations/__pycache__/0004_chat.cpython-37.pyc new file mode 100644 index 0000000..f012185 Binary files /dev/null and b/SocialHelper/homepage/migrations/__pycache__/0004_chat.cpython-37.pyc differ diff --git a/SocialHelper/homepage/models.py b/SocialHelper/homepage/models.py index 2b7e3b6..b44dee8 100644 --- a/SocialHelper/homepage/models.py +++ b/SocialHelper/homepage/models.py @@ -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') diff --git a/SocialHelper/homepage/templates/homepage/user_profile.html b/SocialHelper/homepage/templates/homepage/user_profile.html index 0310e7a..29b6354 100644 --- a/SocialHelper/homepage/templates/homepage/user_profile.html +++ b/SocialHelper/homepage/templates/homepage/user_profile.html @@ -11,12 +11,63 @@

Profil użytkownika

-
{{ name }}
-
- - {% if user.email %} -

- {% endif %} +
{{ name }}


+

Średnia Ocena: {{ocena}}

+ 0 + + {% if ocena > 9 %} + + {% else %} + + {% endif %} + {% if ocena > 19 %} + + {% else %} + + {% endif %} + {% if ocena > 29 %} + + {% else %} + + {% endif %} + {% if ocena > 39 %} + + {% else %} + + {% endif %} + {% if ocena > 49 %} + + {% else %} + + {% endif %} + {% if ocena > 59 %} + + {% else %} + + {% endif %} + {% if ocena > 69 %} + + {% else %} + + {% endif %} + {% if ocena > 79 %} + + {% else %} + + {% endif %} + {% if ocena > 89 %} + + {% else %} + + {% endif %} + {% if ocena > 99 %} + + {% else %} + + {% endif %} 100 + {% if user.email %} +

+ {% endif %}
diff --git a/SocialHelper/homepage/views.py b/SocialHelper/homepage/views.py index c3083d1..277fa3a 100644 --- a/SocialHelper/homepage/views.py +++ b/SocialHelper/homepage/views.py @@ -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