Merge branch 'develop' of http://git.general-servers.com/expomap/expomap
commit
07054bcd83
8 changed files with 155 additions and 6 deletions
@ -0,0 +1,21 @@ |
|||||||
|
{% extends 'base_catalog.html' %} |
||||||
|
{% load i18n %} |
||||||
|
|
||||||
|
{% block bread_scrumbs %} |
||||||
|
|
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block page_title %} |
||||||
|
<div class="page-title"> |
||||||
|
<h1>{% if meta %}{{ meta.h1 }}{% else %}{% trans 'Переводчики' %}{% endif %}</h1> |
||||||
|
</div> |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
|
||||||
|
{% block content_list %} |
||||||
|
{% include 'client/includes/accounts/translators.html' with object_list=object_list %} |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block paginator %} |
||||||
|
{% include 'includes/catalog_paginator.html' with page_obj=page_obj %} |
||||||
|
{% endblock %} |
||||||
@ -0,0 +1,56 @@ |
|||||||
|
{% load static %} |
||||||
|
{% load i18n %} |
||||||
|
{% load template_filters %} |
||||||
|
|
||||||
|
<ul class="cat-list cl-visitors"> |
||||||
|
{% for user in object_list %} |
||||||
|
<li class="cl-item"> |
||||||
|
<div class="cl-item-wrap clearfix"> |
||||||
|
<a href="{{ user.get_permanent_url }}"> |
||||||
|
<div class="cli-pict"> |
||||||
|
{% with obj=user %} |
||||||
|
{% include 'includes/show_logo.html' %} |
||||||
|
{% endwith %} |
||||||
|
</div> |
||||||
|
</a> |
||||||
|
<div class="cli-info"> |
||||||
|
<div class="cli-top clearfix"> |
||||||
|
<header> |
||||||
|
<div class="cli-title"> |
||||||
|
<a href="{{ user.get_permanent_url }}">{{ user.get_full_name }}</a> |
||||||
|
</div> |
||||||
|
</header> |
||||||
|
</div> |
||||||
|
<div class="cli-bot clearfix"> |
||||||
|
<div class="cli-position">{{ user.translator.languages }}</div> |
||||||
|
|
||||||
|
{% if user.profile.country %} |
||||||
|
<div class="cli-place"><a href="/translators/country/{{ user.profile.country.url }}/">{{ user.profile.country }}</a>{% if user.profile.city %}, <a href="/translators/city/{{ user.profile.city.url }}/">{{ user.profile.city }}</a>{% endif %}</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="cli-buttons clearfix"> |
||||||
|
<div class="cli-m-buttons"> |
||||||
|
<a class="button icon-info" href="{{ user.get_permanent_url }}">{% trans 'информация' %}</a> |
||||||
|
</div> |
||||||
|
{% comment %} |
||||||
|
<div class="cli-s-buttons"> |
||||||
|
{% if user.is_authenticated %} |
||||||
|
<a class="button icon-msg" href="#">{% trans 'отправить сообщение' %}</a> |
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
{% endcomment %} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% comment %} |
||||||
|
<footer class="clearfix"> |
||||||
|
<div class="cli-tags"> |
||||||
|
|
||||||
|
</div> |
||||||
|
</footer> |
||||||
|
{% endcomment %} |
||||||
|
</li> |
||||||
|
{% endfor %} |
||||||
|
</ul> |
||||||
|
|
||||||
@ -0,0 +1,13 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from django.conf.urls import patterns, include, url |
||||||
|
from translator.views import TranslatorList |
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = patterns('', |
||||||
|
url(r'^city/(?P<city>.*)/page/(?P<page>\d+)/$', TranslatorList.as_view(), {'meta_id':88}), |
||||||
|
url(r'^city/(?P<city>.*)/$', TranslatorList.as_view(), {'meta_id':88}), |
||||||
|
url(r'^country/(?P<country>.*)/page/(?P<page>\d+)/$', TranslatorList.as_view(), {'meta_id':87}), |
||||||
|
url(r'^country/(?P<country>.*)/$', TranslatorList.as_view(), {'meta_id':87}), |
||||||
|
url(r'^page/(?P<page>\d+)/$', TranslatorList.as_view() , {'meta_id':86}), |
||||||
|
url(r'^', TranslatorList.as_view() , {'meta_id':86}), |
||||||
|
) |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
from django.views.generic import ListView |
||||||
|
from django.shortcuts import get_object_or_404 |
||||||
|
from django.conf import settings |
||||||
|
from functions.cache_mixin import JitterCacheMixin, CacheMixin |
||||||
|
from meta.views import MetadataMixin |
||||||
|
from accounts.models import User |
||||||
|
from country.models import Country |
||||||
|
from city.models import City |
||||||
|
from translator.models import Translator |
||||||
|
|
||||||
|
class TranslatorList(JitterCacheMixin, MetadataMixin, ListView): |
||||||
|
model = User |
||||||
|
template_name = 'client/accounts/translators/translators_list.html' |
||||||
|
paginate_by = settings.CLIENT_PAGINATION |
||||||
|
def get_queryset(self): |
||||||
|
# all users with translator profile |
||||||
|
qs = self.model.objects.select_related('profile', 'country', 'city').filter(translator__isnull=False) |
||||||
|
|
||||||
|
if self.kwargs.get('city'): |
||||||
|
city_slug = self.kwargs.get('city') |
||||||
|
city = get_object_or_404(City, url=city_slug) |
||||||
|
self.kwargs['city'] = city |
||||||
|
qs = qs.filter(profile__city=city) |
||||||
|
if self.kwargs.get('country'): |
||||||
|
country_slug = self.kwargs.get('country') |
||||||
|
country = get_object_or_404(Country, url=country_slug) |
||||||
|
self.kwargs['country'] = country |
||||||
|
qs = qs.filter(profile__country=country) |
||||||
|
|
||||||
|
return qs |
||||||
Loading…
Reference in new issue