From a4c804348dc668731fe51c415c019a98cae1522c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B7=D0=B0=D1=80=20=D0=9A=D0=BE=D1=82=D1=8E?= =?UTF-8?q?=D0=BA?= Date: Tue, 6 Jan 2015 11:59:18 +0200 Subject: [PATCH] Task 28 --- company/views.py | 2 +- proj/settings.py | 1 + .../client/includes/accounts/current_user.html | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/company/views.py b/company/views.py index f3244d9f..b093451d 100644 --- a/company/views.py +++ b/company/views.py @@ -166,7 +166,7 @@ def get_company(request): if request.is_ajax(): term = request.GET['term'] qs = Company.objects.language().filter(translations__name__contains=term).distinct() - result = [{'id': company.id, 'label': company.name} for company in qs] + result = [{'id': company.id, 'label': company.name, 'logo': company.logo.url if company.logo else settings.NO_LOGO } for company in qs] return HttpResponse(json.dumps(result), content_type='application/json') else: return HttpResponse('not ajax') \ No newline at end of file diff --git a/proj/settings.py b/proj/settings.py index 772be17e..72e66aea 100644 --- a/proj/settings.py +++ b/proj/settings.py @@ -413,3 +413,4 @@ except ImportError, e: ADMIN_PAGINATION = 20 CLIENT_PAGINATION = 15 TEMPLATE_DEBUG = DEBUG +NO_LOGO = '/static/client/img/no-logo.png' \ No newline at end of file diff --git a/templates/client/includes/accounts/current_user.html b/templates/client/includes/accounts/current_user.html index c6a2a8a0..f698e97f 100644 --- a/templates/client/includes/accounts/current_user.html +++ b/templates/client/includes/accounts/current_user.html @@ -413,6 +413,20 @@ {# END about #} + {# companies #} + + {% with companies=request.user.created_company.all %} + {% for company in companies %} + {# ссылка с названиями #} + {{ company.name }} + {# лого #} + {% include 'client/includes/show_logo.html' with obj=company %} + {% endfor %} + {% endwith %} + + {# END companies #} + +