summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views
diff options
context:
space:
mode:
Diffstat (limited to 'hyperkitty/views')
-rw-r--r--hyperkitty/views/list.py6
-rw-r--r--hyperkitty/views/thread.py6
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()