diff --git a/article/urls.py b/article/urls.py index 7e6bc606..a0faf232 100644 --- a/article/urls.py +++ b/article/urls.py @@ -3,20 +3,20 @@ from django.conf.urls import patterns, url from views import BlogList, NewsList, BlogDetail, NewsDetail, NewsTagCatalog, BlogsTagCatalog urlpatterns = patterns('', - url(r'^blogs/tag/(?P.*)/page/(?P\d+)/$', BlogsTagCatalog.as_view()), - url(r'^blogs/page/(?P\d+)/$', BlogList.as_view()), - url(r'^blogs/tag/(?P.*)/$', BlogsTagCatalog.as_view()), - url(r'^blogs/$', BlogList.as_view()), + url(r'^blogs/tag/(?P.*)/page/(?P\d+)/$', BlogsTagCatalog.as_view(), {'meta_id':75}), + url(r'^blogs/page/(?P\d+)/$', BlogList.as_view(), {'meta_id':79}), + url(r'^blogs/tag/(?P.*)/$', BlogsTagCatalog.as_view(), {'meta_id':75}), + url(r'^blogs/$', BlogList.as_view(), {'meta_id':79}), - url(r'^news/tag/(?P.*)/(?P\d+)/(?P.*)/page/(?P\d+)/$', NewsTagCatalog.as_view()), - url(r'^news/tag/(?P.*)/(?P\d+)/page/(?P\d+)/$', NewsTagCatalog.as_view()), - url(r'^news/tag/(?P.*)/page/(?P\d+)/$', NewsTagCatalog.as_view()), - url(r'^news/tag/(?P.*)/(?P\d+)/(?P.*)/$', NewsTagCatalog.as_view()), - url(r'^news/tag/(?P.*)/(?P\d+)/$', NewsTagCatalog.as_view()), - url(r'^news/tag/(?P.*)/$', NewsTagCatalog.as_view()), - url(r'^news/page/(?P\d+)/$', NewsList.as_view()), - url(r'^news/$', NewsList.as_view()), + url(r'^news/tag/(?P.*)/(?P\d+)/(?P.*)/page/(?P\d+)/$', NewsTagCatalog.as_view(), {'meta_id':77}), + url(r'^news/tag/(?P.*)/(?P\d+)/page/(?P\d+)/$', NewsTagCatalog.as_view(), {'meta_id':76}), + url(r'^news/tag/(?P.*)/page/(?P\d+)/$', NewsTagCatalog.as_view(), {'meta_id':74}), + url(r'^news/tag/(?P.*)/(?P\d+)/(?P.*)/$', NewsTagCatalog.as_view(), {'meta_id':77}), + url(r'^news/tag/(?P.*)/(?P\d+)/$', NewsTagCatalog.as_view(), {'meta_id':76}), + url(r'^news/tag/(?P.*)/$', NewsTagCatalog.as_view(), {'meta_id':74}), + url(r'^news/page/(?P\d+)/$', NewsList.as_view(), {'meta_id':78}), + url(r'^news/$', NewsList.as_view(), {'meta_id':78}), url(r'^blogs/(?P.*)/$', BlogDetail.as_view(), {'meta_id':19}), url(r'^news/(?P.*)/$', NewsDetail.as_view(), {'meta_id':19}), ) diff --git a/article/views.py b/article/views.py index 2ec8de58..4b421db2 100644 --- a/article/views.py +++ b/article/views.py @@ -9,7 +9,7 @@ from meta.views import MetadataMixin -class NewsList(ListView): +class NewsList(MetadataMixin, ListView): model = Article template_name = 'article/news_list.html' paginate_by = 10 @@ -59,7 +59,7 @@ class NewsDetail(MetadataMixin, DetailView): template_name = 'article/news.html' -class BlogList(ListView): +class BlogList(MetadataMixin, ListView): model = Article template_name = 'article/blog_list.html' paginate_by = 10 @@ -126,6 +126,7 @@ class NewsTagCatalog(MetadataMixin, ListView): def get_queryset(self): slug = self.kwargs.get('slug') tag = get_object_or_404(Tag, url=slug) + self.kwargs['tag'] = tag self.filter_object = tag qs = Article.objects.news().filter(tag=tag) year = self.kwargs.get('year') @@ -172,6 +173,7 @@ class BlogsTagCatalog(MetadataMixin, ListView): def get_queryset(self): slug = self.kwargs.get('slug') tag = get_object_or_404(Tag, url=slug) + self.kwargs['tag'] = tag self.filter_object = tag qs = Article.objects.blogs().filter(tag=tag) year = self.kwargs.get('year') diff --git a/place_exposition/urls.py b/place_exposition/urls.py index 10f7b2f0..6f68b806 100644 --- a/place_exposition/urls.py +++ b/place_exposition/urls.py @@ -15,13 +15,11 @@ urlpatterns = patterns('', #url(r'expo/city/$', ExpositionByCity.as_view()), url(r'city/(?P.*)/page/(?P\d+)/$', PlaceCityCatalog.as_view(), {'meta_id':48}), url(r'city/(?P.*)/$', PlaceCityCatalog.as_view(), {'meta_id':48}), - #!!! url(r'(?P.*)/photo/page/(?P\d+)/$', PlacePhoto.as_view()), url(r'(?P.*)/photo/$', PlacePhoto.as_view()), #url(r'expo/(?P.*)/service/(?P.*)/$', ExpositionServiceView.as_view()), url(r'page/(?P\d+)/$', PlaceList.as_view(), {'meta_id':46}), url(r'(?P.*)/$', PlaceDetail.as_view(), {'meta_id':47}), - url(r'$', PlaceList.as_view(), {'meta_id':46}), ) diff --git a/proj/urls.py b/proj/urls.py index 862d4cd5..bb004455 100644 --- a/proj/urls.py +++ b/proj/urls.py @@ -44,9 +44,8 @@ urlpatterns = patterns('', url(r'^', include('password_reset.urls')), url(r'^i18n/', include('django.conf.urls.i18n')), #url(r'^social/', include('social_auth.urls')), - # admin part #url(r'^', include('settings.old_urls')), - url(r'^search/', include('haystack.urls')), + #url(r'^search/', include('haystack.urls')), url(r'^', include('service.urls')), ) @@ -65,7 +64,6 @@ urlpatterns += patterns('', url(r'^search-form/autosearch/company/$', 'settings.views.company_autosearch'), url(r'^', include('settings.old_urls')), url(r'^', include('accounts.user_catalog_urls')), - ) diff --git a/service/urls.py b/service/urls.py index 8ec4c632..2508a156 100644 --- a/service/urls.py +++ b/service/urls.py @@ -15,6 +15,5 @@ urlpatterns = patterns('', url(r'service/com_rek/$', 'service.views.advertise'), url(r'service/(?P.*)/$', ServiceView.as_view()), - ) diff --git a/settings/management/commands/do_inflect.py b/settings/management/commands/do_inflect.py new file mode 100644 index 00000000..601a69a3 --- /dev/null +++ b/settings/management/commands/do_inflect.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from django.core.management.base import BaseCommand, CommandError +from django.conf import settings +import xlrd +from theme.models import Tag, Theme +from city.models import City + +CITIES = settings.MEDIA_ROOT+'/import/cities_inflect.xls' +TAGS = settings.MEDIA_ROOT+'/import/tags_inflect.xls' + + + +class Command(BaseCommand): + def handle(self, *args, **options): + f = open(TAGS, 'r') + book = xlrd.open_workbook(file_contents=f.read()) + sheet = book.sheet_by_index(0) + row_list = [sheet.row_values(row_number) for row_number in range(sheet.nrows)] + print(row_list[2][0]) + for row_number, row in enumerate(row_list[2:]): + url = row[1] + print(url) + inflect = row[3] + if inflect: + Tag.objects.filter(url=url).update(inflect=inflect) + + + + #City.objects.filter(url=url).update(inflect=row[4]) + + + #try: + # city = City.objects.get(id=id) + #except City.DoesNotExist: + # print() + diff --git a/templates/client/article/blog_list.html b/templates/client/article/blog_list.html index 8e53acbe..de840d8d 100644 --- a/templates/client/article/blog_list.html +++ b/templates/client/article/blog_list.html @@ -35,22 +35,7 @@ -
-
-
- {% for blog in object_list %} -
-
- {% include 'includes/article/article_preview.html' with obj=blog %} -

{{ blog.main_title }}

- {{ blog.preview|safe }} - {{ blog.created|date:"d E Y" }}{% if blog.tag.all.exists %}{% include 'includes/article_tags.html' with obj=blog %}{% endif %} -
-
- {% endfor %} -
-
-
+{% include 'client/includes/article/blog_list.html' with object_list=object_list %} {% if request.GET.debug == '1' %} diff --git a/templates/client/article/catalog.html b/templates/client/article/catalog.html index 43ef02f6..46a79584 100644 --- a/templates/client/article/catalog.html +++ b/templates/client/article/catalog.html @@ -3,6 +3,7 @@ {% load i18n %} + {% block bread_scrumbs %}