diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 0600cb5..9b25660 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -111,7 +111,7 @@ WSGI_APPLICATION = 'archilance.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'archilance2', + 'NAME': 'archilance', 'USER': 'postgres', 'PASSWORD': 'postgres', 'HOST': 'localhost', diff --git a/archilance/urls.py b/archilance/urls.py index 8680ab6..373a2a1 100644 --- a/archilance/urls.py +++ b/archilance/urls.py @@ -15,6 +15,7 @@ urlpatterns = [ url(r'^work_sell/', include('work_sell.urls')), url(r'^test/$', TemplateView.as_view(template_name='test.html'), name='test'), url(r'^projects/', include('projects.urls')), + url(r'^wallets/', include('wallets.urls')), url(r'^chat/', include('chat.urls')), url(r'^specializations/', include('specializations.urls')), url(r'^users/', include('users.urls')), diff --git a/chat/testapp.py b/chat/testapp.py index 0922d45..fe64028 100644 --- a/chat/testapp.py +++ b/chat/testapp.py @@ -92,7 +92,7 @@ if __name__ == '__main__': ioloop = IOLoop.instance() application.db = momoko.Pool( - dsn='dbname=archilance2 user=postgres password=postgres host=localhost', + dsn='dbname=archilance user=postgres password=postgres host=localhost', size=1, ioloop=ioloop, ) diff --git a/ratings/management/commands/recalculation_spec.py b/ratings/management/commands/recalculation_spec.py index 518ffa2..acfb5d5 100644 --- a/ratings/management/commands/recalculation_spec.py +++ b/ratings/management/commands/recalculation_spec.py @@ -15,21 +15,29 @@ class Command(BaseCommand): result_list.append([user['rating'], 'user', user['pk']]) for team in teams: - result_list.append([team['rating'], 'team',team['pk'] ]) + result_list.append([team['rating'], 'team', team['pk'] ]) - print(sorted(result_list)) - # SpecializationRating.objects.all().delete() - # contractors = User.contractor_objects.order_by('-rating') - # specializations = Specialization.objects.all() - # for spec in specializations: - # i = 0 - # for contractor in contractors: - # if spec in contractor.contractor_specializations.all(): - # i += 1 - # spec_rating = SpecializationRating() - # spec_rating.position = i - # spec_rating.user = contractor - # spec_rating.specialization = spec - # spec_rating.save() - # - # print('The End') + result_list = list(reversed(sorted(result_list))) + SpecializationRating.objects.all().delete() + specializations = Specialization.objects.all() + for spec in specializations: + i = 0 + for res in result_list: + if 'user' in res[1]: + user = User.objects.get(pk=res[2]) + team = None + specializations_current = user.contractor_specializations.all() + else: + team = Team.objects.get(pk=res[2]) + user = None + specializations_current = team.specializations.all() + + if spec in specializations_current: + i += 1 + spec_rating = SpecializationRating() + spec_rating.position = i + spec_rating.user = user + spec_rating.team = team + spec_rating.specialization = spec + spec_rating.save() + print('The end') diff --git a/ratings/templatetags/specializtions_tags.py b/ratings/templatetags/specializtions_tags.py index 65649b0..b79e82c 100644 --- a/ratings/templatetags/specializtions_tags.py +++ b/ratings/templatetags/specializtions_tags.py @@ -15,9 +15,10 @@ def specialization_widget(context, user_id): 'user_id': user_id, } +@register.inclusion_tag('templatetags/specializations_widget.html', takes_context=True) def specialization_team_widget(context, team_id): team_id = int(team_id) - specializations = [] + specializations = SpecializationRating.objects.select_related('specialization').filter(team_id=team_id) return { 'specializations': specializations, } diff --git a/templates/partials/header.html b/templates/partials/header.html index 253d922..2e2c01f 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -100,28 +100,16 @@
  • - - Сообщения - - + Сообщения
  • - - Счет - - + Счет
  • - - Настройки - - + Настройки
  • - - FAQ - - + FAQ
  • diff --git a/users/templates/contractor_office.html b/users/templates/contractor_office.html index 803aac4..4b495d7 100644 --- a/users/templates/contractor_office.html +++ b/users/templates/contractor_office.html @@ -150,7 +150,7 @@
    - {% specialization_widget contractor.pk %} + {% specialization_team_widget contractor.team.pk %}
    diff --git a/users/templates/partials/customer_profile_info_block.html b/users/templates/partials/customer_profile_info_block.html index bbb1c08..1c74fc5 100644 --- a/users/templates/partials/customer_profile_info_block.html +++ b/users/templates/partials/customer_profile_info_block.html @@ -1,6 +1,4 @@ -{% load projects_tags %} - - +{% load specializtions_tags %}
    diff --git a/wallets/templates/score-detail.html b/wallets/templates/score-detail.html new file mode 100644 index 0000000..a7c8d38 --- /dev/null +++ b/wallets/templates/score-detail.html @@ -0,0 +1,65 @@ +{% extends 'partials/base.html' %} + +{% load staticfiles %} +{% load thumbnail %} +{% block content %} + + +{% include 'partials/header.html' %} +
    +
    +
    +

    Ваш счет

    +
    +
    +
    +
    +

    35 000

    + + + + + + + + + + + + + + + + + + + + + +
    ДатаОписаниеПоступление/СписаниеБаланс
    23.01.2016 + Оплата этапа 1 по заказу «Сложный долгий заказ» + + +35 000 + + + 53 000 + +
    23.01.2016 + Оплата этапа 1 по заказу «Сложный долгий заказ» + + +35 000 + + + 53 000 + +
    +
    +
    + {% include 'partials/footer.html' %} +
    +
    +{% endblock %} diff --git a/wallets/urls.py b/wallets/urls.py new file mode 100755 index 0000000..b0726e5 --- /dev/null +++ b/wallets/urls.py @@ -0,0 +1,9 @@ +from django.conf import urls +from django.conf.urls import include +from .views import ScoreDetailView + +app_name = 'wallets' + +urlpatterns = [ + urls.url(r'^score/(?P\d+)/$', ScoreDetailView.as_view(), name='score-detail'), +] diff --git a/wallets/views.py b/wallets/views.py index 91ea44a..01de4ce 100644 --- a/wallets/views.py +++ b/wallets/views.py @@ -1,3 +1,9 @@ from django.shortcuts import render +from django.views.generic import DetailView +from users.models import User + + +class ScoreDetailView(DetailView): + model = User + template_name = 'score-detail.html' -# Create your views here.