diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-07-11 17:18:25 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-07-11 17:18:25 +0200 |
commit | 39deff37c950534d2a44e4bd040e49118b34a731 (patch) | |
tree | 5f950b3c0c9e2ca81b1c6192ea1ef280e0ec7e90 /hyperkitty/views | |
parent | 2c7c64b084040ad0666b15c511ff18bb96fc79b9 (diff) | |
download | hyperkitty-39deff37c950534d2a44e4bd040e49118b34a731.tar.gz hyperkitty-39deff37c950534d2a44e4bd040e49118b34a731.tar.xz hyperkitty-39deff37c950534d2a44e4bd040e49118b34a731.zip |
Add the category on the threads list
Diffstat (limited to 'hyperkitty/views')
-rw-r--r-- | hyperkitty/views/list.py | 6 | ||||
-rw-r--r-- | hyperkitty/views/thread.py | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index 8b222c4..8a96fd2 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -33,7 +33,7 @@ from django.http import Http404 from hyperkitty.models import Tag, Favorite, LastView from hyperkitty.lib import get_months, get_store, get_display_dates, daterange -from hyperkitty.lib import FLASH_MESSAGES, paginate +from hyperkitty.lib import FLASH_MESSAGES, paginate, get_category_widget from hyperkitty.lib.voting import get_votes, set_message_votes, set_thread_votes @@ -107,6 +107,10 @@ def _thread_list(request, mlist, threads, template_name='thread_list.html', extr except Tag.DoesNotExist: thread.tags = [] + # Category + thread.category_hk, thread.category_form = \ + get_category_widget(request, thread.category) + # Unread status thread.unread = False if request.user.is_authenticated(): diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py index 365dca9..ecfd6eb 100644 --- a/hyperkitty/views/thread.py +++ b/hyperkitty/views/thread.py @@ -36,6 +36,7 @@ import robot_detection from hyperkitty.models import Tag, Favorite, LastView, ThreadCategory from hyperkitty.views.forms import AddTagForm, ReplyForm, CategoryForm from hyperkitty.lib import get_months, get_store, stripped_subject +from hyperkitty.lib import get_category_widget from hyperkitty.lib.voting import set_message_votes @@ -303,7 +304,10 @@ def set_category(request, mlist_fqdn, threadid): store = get_store(request) category, category_form = get_category_widget(request) thread = store.get_thread(mlist_fqdn, threadid) - if category.name != thread.category: + if not category and thread.category: + thread.category = None + store.commit() + elif category and category.name != thread.category: thread.category = category.name store.commit() |