parent
60ece0c155
commit
2ba6556e01
13 changed files with 49 additions and 210 deletions
@ -1,6 +1,6 @@ |
|||||||
|
|
||||||
{% with theme=obj.blog_theme.all %} |
{% with theme=obj.theme.all %} |
||||||
{% for theme in obj.blog_theme.all %} |
{% for theme in obj.theme.all %} |
||||||
<a href="{{ obj.get_catalog }}theme/{{ theme.url }}/" title="">{{ theme.name }}</a>{% if forloop.counter != themes|length %},{% endif %} |
<a href="{{ obj.get_catalog }}theme/{{ theme.url }}/" title="">{{ theme.name }}</a>{% if forloop.counter != themes|length %},{% endif %} |
||||||
{% endfor %} |
{% endfor %} |
||||||
{% endwith %} |
{% endwith %} |
||||||
|
|||||||
@ -1,26 +1,25 @@ |
|||||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||||
from django.conf.urls import patterns, include, url |
from django.conf.urls import include, patterns, url |
||||||
from admin import TagListView, ThemeListView |
|
||||||
from .admin import ThemeBlogCreateView, ThemeBlogUpdateView, ThemeBlogDeleteView, ThemeBlogListView |
|
||||||
|
|
||||||
|
from .admin import TagListView, ThemeListView |
||||||
|
|
||||||
urlpatterns = patterns('theme.admin', |
urlpatterns = patterns('theme.admin', |
||||||
|
# add |
||||||
url(r'^theme/add.*/$', 'theme_add'), |
url(r'^theme/add.*/$', 'theme_add'), |
||||||
url(r'^tag/add.*/$', 'tag_add'), |
url(r'^tag/add.*/$', 'tag_add'), |
||||||
url(r'^blog_theme/add/$', 'blog_theme_add', name = 'theme_blog_new'), |
# delete |
||||||
url(r'^theme/delete/(?P<theme_id>\d+)/$', 'theme_delete'), |
url(r'^theme/delete/(?P<theme_id>\d+)/$', 'theme_delete'), |
||||||
url(r'^tag/delete/(?P<tag_id>\d+)/$', 'tag_delete'), |
url(r'^tag/delete/(?P<tag_id>\d+)/$', 'tag_delete'), |
||||||
url(r'^blog_theme/delete/(?P<theme_id>\d+)/$', ThemeBlogDeleteView.as_view(), name = 'theme_blog_delete'), |
# change |
||||||
url(r'^theme/change/(?P<theme_id>\d+).*/$', 'theme_change'), |
url(r'^theme/change/(?P<theme_id>\d+).*/$', 'theme_change'), |
||||||
url(r'^blog_theme/change/(?P<theme_id>\d+).*/$', 'blog_theme_change', name= "theme_blog_change"), |
|
||||||
url(r'^tag/change/(?P<tag_id>\d+).*/$', 'tag_change'), |
url(r'^tag/change/(?P<tag_id>\d+).*/$', 'tag_change'), |
||||||
|
# copy |
||||||
url(r'^theme/copy/(?P<theme_id>\d+).*/$', 'theme_copy'), |
url(r'^theme/copy/(?P<theme_id>\d+).*/$', 'theme_copy'), |
||||||
url(r'^tag/copy/(?P<tag_id>\d+).*/$', 'tag_copy'), |
url(r'^tag/copy/(?P<tag_id>\d+).*/$', 'tag_copy'), |
||||||
#url(r'^theme/all/$', 'theme_all'), |
# all |
||||||
#url(r'^tag/all/$', 'tag_all'), |
|
||||||
url(r'^theme/all/$', ThemeListView.as_view()), |
url(r'^theme/all/$', ThemeListView.as_view()), |
||||||
url(r'^blog_theme/all/$', ThemeBlogListView.as_view(), name="theme_blog_all"), |
|
||||||
url(r'^tag/all/$', TagListView.as_view()), |
url(r'^tag/all/$', TagListView.as_view()), |
||||||
|
# search |
||||||
url(r'^tag/search/$', 'search_tag'), |
url(r'^tag/search/$', 'search_tag'), |
||||||
url(r'^tag/search-without-theme/$', 'search2'), |
url(r'^tag/search-without-theme/$', 'search2'), |
||||||
) |
) |
||||||
|
|||||||
@ -1,14 +0,0 @@ |
|||||||
from django.core.management.base import BaseCommand, CommandError |
|
||||||
from theme.models import Theme, ThemeBlog |
|
||||||
from article.models import Article |
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand): |
|
||||||
def handle(self, *args, **options): |
|
||||||
for article in Article.objects.filter(type=Article.blog).prefetch_related('blog_theme'): |
|
||||||
blogthemes = article.blog_theme.all().values_list('id', flat=True) |
|
||||||
themes = Theme.objects.filter( |
|
||||||
types=Theme.types.article, |
|
||||||
blogtheme_linking_id__in=blogthemes) |
|
||||||
article.theme.clear() |
|
||||||
article.theme.add(*themes) |
|
||||||
Loading…
Reference in new issue