diff --git a/ratings/templates/templatetags/ratings_widget.html b/ratings/templates/templatetags/ratings_widget.html
index 9a9305d..e756f47 100644
--- a/ratings/templates/templatetags/ratings_widget.html
+++ b/ratings/templates/templatetags/ratings_widget.html
@@ -1,12 +1,12 @@
diff --git a/ratings/templates/templatetags/specializations_widget.html b/ratings/templates/templatetags/specializations_widget.html
index 65d20f0..1c0261a 100644
--- a/ratings/templates/templatetags/specializations_widget.html
+++ b/ratings/templates/templatetags/specializations_widget.html
@@ -1,38 +1,3 @@
-{##}
-{##}
-{# #}
-{#
#}
-{# Специализации:#}
-{#
#}
-{#
#}
-{# Интерьеры#}
-{# 2-й#}
-{#
#}
-{#
#}
-{# Визуализация/3D#}
-{# 45-й#}
-{#
#}
-{#
#}
-{# Экстерьеры#}
-{# 10-й#}
-{#
#}
-{#
#}
-{#
#}
-{# Архитектура#}
-{# 3-й#}
-{#
#}
-{#
#}
-{# 3D Моделирование#}
-{# 100-й#}
-{#
#}
-{#
#}
-{#
#}
-{#
#}
-
-
-
Специализации:
{% for spec in specializations %}
@@ -40,5 +5,7 @@
{{ spec.specialization.name }}
{{ spec.position }}-й
+ {% empty %}
+ Рейтинги скоро будут рассчитаны
{% endfor %}
diff --git a/ratings/templatetags/specializtions_tags.py b/ratings/templatetags/specializtions_tags.py
index 6ef72bb..2659523 100644
--- a/ratings/templatetags/specializtions_tags.py
+++ b/ratings/templatetags/specializtions_tags.py
@@ -1,11 +1,13 @@
from django import template
-from archilance import util
-from users.models import User, Team
+from projects.models import Order
from ratings.models import SpecializationRating
+from reviews.models import Review
+from users.models import User, Team
register = template.Library()
+
@register.inclusion_tag('templatetags/specializations_widget.html', takes_context=True)
def specialization_widget(context, user_id, class_name=None):
user_id = int(user_id)
@@ -25,18 +27,26 @@ def specialization_team_widget(context, team_id):
}
-
@register.inclusion_tag("templatetags/ratings_widget.html", takes_context=True)
def ratings_widget(context, user_id, class_name=None):
ratings = User.objects.get(pk=user_id).rating
return {
'ratings': ratings,
- 'class_name': class_name
+ 'class_name': class_name,
+ 'deals': Order.objects.filter(secure=True, contractor_id=user_id, status=1).count(),
+ 'reviews_n': Review.objects.filter(target_contractor_id=user_id, type='neutral').count(),
+ 'reviews_m': Review.objects.filter(target_contractor_id=user_id, type='negative').count(),
+ 'reviews_p': Review.objects.filter(target_contractor_id=user_id, type='positive').count(),
}
+
@register.inclusion_tag("templatetags/ratings_widget.html", takes_context=True)
def ratings_team_widget(context, team_id):
ratings = Team.objects.get(pk=team_id).rating
return {
'ratings': ratings,
+ 'deals': Order.objects.filter(secure=True, team_id=team_id, status=1).count(),
+ 'reviews_n': Review.objects.filter(target_team_id=team_id, type='neutral').count(),
+ 'reviews_m': Review.objects.filter(target_team_id=team_id, type='negative').count(),
+ 'reviews_p': Review.objects.filter(target_team_id=team_id, type='positive').count(),
}
diff --git a/users/templates/contractor_office.html b/users/templates/contractor_office.html
index de876f1..18e87b8 100644
--- a/users/templates/contractor_office.html
+++ b/users/templates/contractor_office.html
@@ -91,7 +91,8 @@
Программист
-
+ {% empty %}
+ В группе пока нет участников
{% endfor %}
@@ -176,15 +177,19 @@
+ {% empty %}
+
+
Работ в портфолио пока нет
+
{% endfor %}
-
-
+{# TODO:#}
+{# #}
@@ -208,38 +213,45 @@
+ {% empty %}
+
+
Готовых работ пока нет
+
{% endfor %}
-
+{# TODO#}
+{# #}
+ {% for review in reviews %}
- Иванов Петр Иванович
+ {{ review.get_sender }}
-
- Безопасная сделка
-
+ {% if review.project.deal_type == 'secure_deal' %}
+
+ Безопасная сделка
+
+ {% endif %}
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum
-
+ {{ review.text|safe }}
+ {% empty %}
+
+ {% endfor %}
diff --git a/users/templates/contractor_profile.html b/users/templates/contractor_profile.html
index 0d69861..55c0941 100644
--- a/users/templates/contractor_profile.html
+++ b/users/templates/contractor_profile.html
@@ -196,7 +196,12 @@
{% endif %}
+ {% empty %}
+
+
Работ в портфолио пока нет
+
{% endfor %}
+
@@ -455,6 +460,10 @@
+ {% empty %}
+
{% endfor %}
diff --git a/users/views.py b/users/views.py
index d87e666..e51ba37 100644
--- a/users/views.py
+++ b/users/views.py
@@ -375,6 +375,7 @@ class ContractorOfficeDetailView(DetailView):
work_sells = WorkSell.objects.filter(contractor__in=user_ids)
context['portfolios'] = portfolios
context['work_sells'] = work_sells
+ context['reviews'] = Review.objects.filter(target_contractor__in=user_ids)
return context
diff --git a/wallets/views.py b/wallets/views.py
index e5a11f8..84df34c 100644
--- a/wallets/views.py
+++ b/wallets/views.py
@@ -1,27 +1,25 @@
-from django.conf import urls, settings
+from django.conf import settings
from django.contrib import messages
+from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Sum
-from django.http import HttpResponse, JsonResponse, HttpResponseForbidden
+from django.http import HttpResponse, JsonResponse
from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import DetailView, CreateView
from django.views.generic.base import View
-from pprint import pprint, pformat
-import logging
+from users.models import User
from .forms import WithDrawForm, TmpCheckOrderForm, TmpPaymentAvisoForm
from .models import InvoiceHistory, WithDraw, Transaction
-from users.mixins import CheckForUserMixin
-from users.models import User
class ScoreDetailView(DetailView):
model = User
template_name = 'score-detail.html'
context_object_name = 'user_score'
-
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user_score_balance = InvoiceHistory.objects.filter(user=self.get_object()).aggregate(Sum('sum'))
@@ -30,16 +28,15 @@ class ScoreDetailView(DetailView):
return context
-class ScoreView(View):
+class ScoreView(LoginRequiredMixin, View):
template_name = 'score-detail.html'
def get(self, request, *args, **kwargs):
- # transaction = Transaction.objects.get_or_create(customer=request.user, complete=False)
- transaction = Transaction.objects.create(customer=request.user,type='add')
+ transaction = Transaction.objects.create(customer=request.user, type='add')
user_score = get_object_or_404(User.objects, pk=kwargs.get('pk'))
current_sum_info = InvoiceHistory.objects.filter(user=user_score).aggregate(Sum('sum'))
user_score_balance = current_sum_info['sum__sum'] or 0
-
+
return render(request, self.template_name, {
'transaction': transaction,
'YANDEX_MONEY': settings.YANDEX_MONEY,
@@ -96,23 +93,22 @@ class WithDrawCreate(CreateView):
return super().form_invalid(form)
-
# Yandex Money ------------------------------------------------
class TmpCheckOrderView(View):
form_class = TmpCheckOrderForm
-
+
@method_decorator(csrf_exempt)
def dispatch(self, request, *args, **kwargs):
return super().dispatch(request, *args, **kwargs)
-
+
def post(self, request, *args, **kwargs):
form = self.form_class(request.POST)
-
+
# trans = form.cleaned_data.get('transaction')
-
+
if form.is_valid():
res = """
@@ -141,21 +137,21 @@ class TmpCheckOrderView(View):
invoice_id=form.cleaned_data.get('invoiceId'),
shop_id=form.cleaned_data.get('shopId'),
)
-
+
return HttpResponse(res, content_type='application/xml')
# return HttpResponse('{msg}'.format(msg=pformat(form.errors))) # Debug
class TmpPaymentAvisoView(View):
form_class = TmpPaymentAvisoForm
-
+
@method_decorator(csrf_exempt)
def dispatch(self, request, *args, **kwargs):
return super().dispatch(request, *args, **kwargs)
-
+
def post(self, request, *args, **kwargs):
form = self.form_class(request.POST)
-
+
if form.is_valid():
transaction = form.cleaned_data.get('transaction_id')
transaction.complete = True
@@ -173,7 +169,7 @@ class TmpPaymentAvisoView(View):
invoice_id=form.cleaned_data.get('invoiceId'),
shop_id=form.cleaned_data.get('shopId'),
)
-
+
return HttpResponse(res, content_type='application/xml')
else:
res = """
@@ -183,6 +179,6 @@ class TmpPaymentAvisoView(View):
message="Payment aviso, validation error"
techMessage="Payment aviso, validation error"/>
""".format(date=timezone.now().isoformat())
-
+
return HttpResponse(res, content_type='application/xml')
# return HttpResponse('{msg}'.format(msg=pformat(form.errors))) # Debug