# HG changeset patch
# User Brian Neal
# Date 1409443892 18000
# Node ID dbc389a409f5879a0ba4092321fe15d77d801f28
# Parent 6bbd1473d48e04b1cfc041db32a5e61d13f89033
Work in progress: rework private messages. Add trash view.
diff -r 6bbd1473d48e -r dbc389a409f5 messages/urls.py
--- a/messages/urls.py Sat Aug 30 17:25:38 2014 -0500
+++ b/messages/urls.py Sat Aug 30 19:11:32 2014 -0500
@@ -15,9 +15,9 @@
url(r'^outbox/$',
'messages.views.outbox',
name='messages-outbox'),
-# url(r'^trash/$',
-# 'messages.views.trash',
-# name='messages-trash'),
+ url(r'^trash/$',
+ 'messages.views.trash',
+ name='messages-trash'),
# url(r'^options/$',
# 'messages.views.options',
# name='messages-options'),
diff -r 6bbd1473d48e -r dbc389a409f5 messages/views.py
--- a/messages/views.py Sat Aug 30 17:25:38 2014 -0500
+++ b/messages/views.py Sat Aug 30 19:11:32 2014 -0500
@@ -97,6 +97,21 @@
@login_required
+def trash(request):
+
+ msg_list = Message.objects.trash(request.user)
+
+ page = _get_page(request, msg_list)
+
+ return render(request, 'messages/trash.html', {
+ 'tab': 'trash',
+ 'page': page,
+ 'inbox_pct': None,
+ 'outbox_pct': None,
+ })
+
+
+@login_required
def compose_to(request, receiver):
"""
This function displays the base tabbed private messages view,
@@ -113,27 +128,6 @@
})
-def trash(request):
- """
- Returns the trash for the user.
-
- """
- if not request.user.is_authenticated():
- return HttpResponseForbidden()
-
- msg_list = Message.objects.trash(request.user)
- paginator = Paginator(msg_list, MSGS_PER_PAGE)
- try:
- msgs = paginator.page(_get_page(request))
- except (EmptyPage, InvalidPage):
- msgs = paginator.page(paginator.num_pages)
-
- return render(request, 'messages/trash_tab.html', {
- 'msgs': msgs,
- 'url': reverse('messages-trash'),
- })
-
-
def message(request):
"""
This view function retrieves a message and returns it as a JSON object.
diff -r 6bbd1473d48e -r dbc389a409f5 sg101/templates/messages/inbox.html
--- a/sg101/templates/messages/inbox.html Sat Aug 30 17:25:38 2014 -0500
+++ b/sg101/templates/messages/inbox.html Sat Aug 30 19:11:32 2014 -0500
@@ -6,6 +6,7 @@
Messages in italics have been replied to.
{% if page.object_list %}
+ {% include "messages/pagination.html" %}