[snowy] Add a note_list page, import pagination



commit b78c10d155732cf7f8af2d1d8a6fec533f4355cb
Author: Brad Taylor <brad getcoded net>
Date:   Fri Jul 24 15:39:32 2009 -0400

    Add a note_list page, import pagination

 lib/pagination/__init__.py                         |    1 +
 lib/pagination/locale/de/LC_MESSAGES/django.po     |   27 +++
 lib/pagination/locale/fr/LC_MESSAGES/django.po     |   26 +++
 lib/pagination/locale/pl/LC_MESSAGES/django.po     |   27 +++
 lib/pagination/middleware.py                       |   10 +
 lib/pagination/models.py                           |    1 +
 .../templates/pagination/pagination.html           |   26 +++
 lib/pagination/templatetags/__init__.py            |    1 +
 lib/pagination/templatetags/pagination_tags.py     |  218 ++++++++++++++++++++
 lib/pagination/tests.py                            |   61 ++++++
 notes/models.py                                    |    3 +-
 notes/templates/notes/note_detail.html             |    2 +-
 notes/templates/notes/note_list.html               |   47 ++++-
 notes/urls.py                                      |    1 +
 notes/views.py                                     |   10 +
 settings.py                                        |    4 +
 site_media/css/screen.css                          |   50 +++++-
 templates/base.html                                |    4 +
 18 files changed, 508 insertions(+), 11 deletions(-)
---
diff --git a/lib/pagination/__init__.py b/lib/pagination/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/lib/pagination/__init__.py
@@ -0,0 +1 @@
+
diff --git a/lib/pagination/locale/de/LC_MESSAGES/django.po b/lib/pagination/locale/de/LC_MESSAGES/django.po
new file mode 100644
index 0000000..d2cf07c
--- /dev/null
+++ b/lib/pagination/locale/de/LC_MESSAGES/django.po
@@ -0,0 +1,27 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-10-24 00:41-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL ADDRESS>\n"
+"Language-Team: LANGUAGE <LL li org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: templates/pagination/pagination.html:5
+#: templates/pagination/pagination.html:7
+msgid "previous"
+msgstr "zurück"
+
+#: templates/pagination/pagination.html:21
+#: templates/pagination/pagination.html:23
+msgid "next"
+msgstr "weiter"
diff --git a/lib/pagination/locale/fr/LC_MESSAGES/django.po b/lib/pagination/locale/fr/LC_MESSAGES/django.po
new file mode 100644
index 0000000..85086d2
--- /dev/null
+++ b/lib/pagination/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,26 @@
+# django-pagination French translation.
+# Copyright (C) 2008, Julien Demoor
+# This file is distributed under the same license as the django-pagination package.
+# Julien Demoor <julien jdemoor com>, 2008
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-10-24 00:41-0700\n"
+"PO-Revision-Date: 2008-10-19 10:19+0200\n"
+"Last-Translator: Julien Demoor <julien jdemoor com>\n"
+"Language-Team: LANGUAGE <LL li org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: templates/pagination/pagination.html:5
+#: templates/pagination/pagination.html:7
+msgid "previous"
+msgstr "précédente"
+
+#: templates/pagination/pagination.html:21
+#: templates/pagination/pagination.html:23
+msgid "next"
+msgstr "suivante"
diff --git a/lib/pagination/locale/pl/LC_MESSAGES/django.po b/lib/pagination/locale/pl/LC_MESSAGES/django.po
new file mode 100644
index 0000000..84b41e3
--- /dev/null
+++ b/lib/pagination/locale/pl/LC_MESSAGES/django.po
@@ -0,0 +1,27 @@
+# Polish translation of django-pagination.
+# Copyright (C) 2008, django-pagination team
+# This file is distributed under the same license as the django-pagination package.
+# Jarek Zgoda <jarek zgoda gmail com>, 2008.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-10-24 00:41-0700\n"
+"PO-Revision-Date: 2008-10-20 20:52+0200\n"
+"Last-Translator: Jarek Zgoda <jarek zgoda gmail com>\n"
+"Language-Team: PL <pl li org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: templates/pagination/pagination.html:5
+#: templates/pagination/pagination.html:7
+msgid "previous"
+msgstr "poprzednia"
+
+#: templates/pagination/pagination.html:21
+#: templates/pagination/pagination.html:23
+msgid "next"
+msgstr "nastÄ?pna"
diff --git a/lib/pagination/middleware.py b/lib/pagination/middleware.py
new file mode 100644
index 0000000..5e917c5
--- /dev/null
+++ b/lib/pagination/middleware.py
@@ -0,0 +1,10 @@
+class PaginationMiddleware(object):
+    """
+    Inserts a variable representing the current page onto the request object if
+    it exists in either **GET** or **POST** portions of the request.
+    """
+    def process_request(self, request):
+        try:
+            request.page = int(request.REQUEST['page'])
+        except (KeyError, ValueError, TypeError):
+            request.page = 1
\ No newline at end of file
diff --git a/lib/pagination/models.py b/lib/pagination/models.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/lib/pagination/models.py
@@ -0,0 +1 @@
+
diff --git a/lib/pagination/templates/pagination/pagination.html b/lib/pagination/templates/pagination/pagination.html
new file mode 100644
index 0000000..37cef40
--- /dev/null
+++ b/lib/pagination/templates/pagination/pagination.html
@@ -0,0 +1,26 @@
+{% if is_paginated %}
+{% load i18n %}
+<div class="pagination">
+    {% if page_obj.has_previous %}
+        <a href="?page={{ page_obj.previous_page_number }}{{ getvars }}" class="prev">&lsaquo;&lsaquo; {% trans "previous" %}</a>
+    {% else %}
+        <span class="disabled prev">&lsaquo;&lsaquo; {% trans "previous" %}</span>
+    {% endif %}
+    {% for page in pages %}
+        {% if page %}
+            {% ifequal page page_obj.number %}
+                <span class="current page">{{ page }}</span>
+            {% else %}
+                <a href="?page={{ page }}{{ getvars }}" class="page">{{ page }}</a>
+            {% endifequal %}
+        {% else %}
+            ...
+        {% endif %}
+    {% endfor %}
+    {% if page_obj.has_next %}
+        <a href="?page={{ page_obj.next_page_number }}{{ getvars }}" class="next">{% trans "next" %} &rsaquo;&rsaquo;</a>
+    {% else %}
+        <span class="disabled next">{% trans "next" %} &rsaquo;&rsaquo;</span>
+    {% endif %}
+</div>
+{% endif %}
diff --git a/lib/pagination/templatetags/__init__.py b/lib/pagination/templatetags/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/lib/pagination/templatetags/__init__.py
@@ -0,0 +1 @@
+
diff --git a/lib/pagination/templatetags/pagination_tags.py b/lib/pagination/templatetags/pagination_tags.py
new file mode 100644
index 0000000..7505b74
--- /dev/null
+++ b/lib/pagination/templatetags/pagination_tags.py
@@ -0,0 +1,218 @@
+try:
+    set
+except NameError:
+    from sets import Set as set
+
+from django import template
+from django.http import Http404
+from django.core.paginator import Paginator, InvalidPage
+from django.conf import settings
+
+register = template.Library()
+
+DEFAULT_PAGINATION = getattr(settings, 'PAGINATION_DEFAULT_PAGINATION', 20)
+DEFAULT_WINDOW = getattr(settings, 'PAGINATION_DEFAULT_WINDOW', 4)
+DEFAULT_ORPHANS = getattr(settings, 'PAGINATION_DEFAULT_ORPHANS', 0)
+INVALID_PAGE_RAISES_404 = getattr(settings, 'PAGINATION_INVALID_PAGE_RAISES_404',
+    False)
+
+def do_autopaginate(parser, token):
+    """
+    Splits the arguments to the autopaginate tag and formats them correctly.
+    """
+    split = token.split_contents()
+    as_index = None
+    context_var = None
+    for i, bit in enumerate(split):
+        if bit == 'as':
+            as_index = i
+            break
+    if as_index is not None:
+        try:
+            context_var = split[as_index + 1]
+        except IndexError:
+            raise template.TemplateSyntaxError("Context variable assignment " +\
+                "must take the form of {%% %r object.example_set.all ... as " +\
+                "context_var_name %%}" % split[0])
+        del split[as_index:as_index + 2]
+    if len(split) == 2:
+        return AutoPaginateNode(split[1])
+    elif len(split) == 3:
+        return AutoPaginateNode(split[1], paginate_by=split[2], 
+            context_var=context_var)
+    elif len(split) == 4:
+        try:
+            orphans = int(split[3])
+        except ValueError:
+            raise template.TemplateSyntaxError(u'Got %s, but expected integer.' % split[3])
+        return AutoPaginateNode(split[1], paginate_by=split[2], orphans=orphans,
+            context_var=context_var)
+    else:
+        raise template.TemplateSyntaxError('%r tag takes one required ' + \
+            'argument and one optional argument' % split[0])
+
+class AutoPaginateNode(template.Node):
+    """
+    Emits the required objects to allow for Digg-style pagination.
+    
+    First, it looks in the current context for the variable specified, and using
+    that object, it emits a simple ``Paginator`` and the current page object 
+    into the context names ``paginator`` and ``page_obj``, respectively.
+    
+    It will then replace the variable specified with only the objects for the
+    current page.
+    
+    .. note::
+        
+        It is recommended to use *{% paginate %}* after using the autopaginate
+        tag.  If you choose not to use *{% paginate %}*, make sure to display the
+        list of available pages, or else the application may seem to be buggy.
+    """
+    def __init__(self, queryset_var, paginate_by=DEFAULT_PAGINATION,
+        orphans=DEFAULT_ORPHANS, context_var=None):
+        self.queryset_var = template.Variable(queryset_var)
+        if isinstance(paginate_by, int):
+            self.paginate_by = paginate_by
+        else:
+            self.paginate_by = template.Variable(paginate_by)
+        self.orphans = orphans
+        self.context_var = context_var
+
+    def render(self, context):
+        key = self.queryset_var.var
+        value = self.queryset_var.resolve(context)
+        if isinstance(self.paginate_by, int):
+            paginate_by = self.paginate_by
+        else:
+            paginate_by = self.paginate_by.resolve(context)
+        paginator = Paginator(value, paginate_by, self.orphans)
+        try:
+            page_obj = paginator.page(context['request'].page)
+        except InvalidPage:
+            if INVALID_PAGE_RAISES_404:
+                raise Http404('Invalid page requested.  If DEBUG were set to ' +
+                    'False, an HTTP 404 page would have been shown instead.')
+            context[key] = []
+            context['invalid_page'] = True
+            return u''
+        if self.context_var is not None:
+            context[self.context_var] = page_obj.object_list
+        else:
+            context[key] = page_obj.object_list
+        context['paginator'] = paginator
+        context['page_obj'] = page_obj
+        return u''
+
+def paginate(context, window=DEFAULT_WINDOW):
+    """
+    Renders the ``pagination/pagination.html`` template, resulting in a
+    Digg-like display of the available pages, given the current page.  If there
+    are too many pages to be displayed before and after the current page, then
+    elipses will be used to indicate the undisplayed gap between page numbers.
+    
+    Requires one argument, ``context``, which should be a dictionary-like data
+    structure and must contain the following keys:
+    
+    ``paginator``
+        A ``Paginator`` or ``QuerySetPaginator`` object.
+    
+    ``page_obj``
+        This should be the result of calling the page method on the 
+        aforementioned ``Paginator`` or ``QuerySetPaginator`` object, given
+        the current page.
+    
+    This same ``context`` dictionary-like data structure may also include:
+    
+    ``getvars``
+        A dictionary of all of the **GET** parameters in the current request.
+        This is useful to maintain certain types of state, even when requesting
+        a different page.
+        """
+    try:
+        paginator = context['paginator']
+        page_obj = context['page_obj']
+        page_range = paginator.page_range
+        # First and last are simply the first *n* pages and the last *n* pages,
+        # where *n* is the current window size.
+        first = set(page_range[:window])
+        last = set(page_range[-window:])
+        # Now we look around our current page, making sure that we don't wrap
+        # around.
+        current_start = page_obj.number-1-window
+        if current_start < 0:
+            current_start = 0
+        current_end = page_obj.number-1+window
+        if current_end < 0:
+            current_end = 0
+        current = set(page_range[current_start:current_end])
+        pages = []
+        # If there's no overlap between the first set of pages and the current
+        # set of pages, then there's a possible need for elusion.
+        if len(first.intersection(current)) == 0:
+            first_list = list(first)
+            first_list.sort()
+            second_list = list(current)
+            second_list.sort()
+            pages.extend(first_list)
+            diff = second_list[0] - first_list[-1]
+            # If there is a gap of two, between the last page of the first
+            # set and the first page of the current set, then we're missing a
+            # page.
+            if diff == 2:
+                pages.append(second_list[0] - 1)
+            # If the difference is just one, then there's nothing to be done,
+            # as the pages need no elusion and are correct.
+            elif diff == 1:
+                pass
+            # Otherwise, there's a bigger gap which needs to be signaled for
+            # elusion, by pushing a None value to the page list.
+            else:
+                pages.append(None)
+            pages.extend(second_list)
+        else:
+            unioned = list(first.union(current))
+            unioned.sort()
+            pages.extend(unioned)
+        # If there's no overlap between the current set of pages and the last
+        # set of pages, then there's a possible need for elusion.
+        if len(current.intersection(last)) == 0:
+            second_list = list(last)
+            second_list.sort()
+            diff = second_list[0] - pages[-1]
+            # If there is a gap of two, between the last page of the current
+            # set and the first page of the last set, then we're missing a 
+            # page.
+            if diff == 2:
+                pages.append(second_list[0] - 1)
+            # If the difference is just one, then there's nothing to be done,
+            # as the pages need no elusion and are correct.
+            elif diff == 1:
+                pass
+            # Otherwise, there's a bigger gap which needs to be signaled for
+            # elusion, by pushing a None value to the page list.
+            else:
+                pages.append(None)
+            pages.extend(second_list)
+        else:
+            differenced = list(last.difference(current))
+            differenced.sort()
+            pages.extend(differenced)
+        to_return = {
+            'pages': pages,
+            'page_obj': page_obj,
+            'paginator': paginator,
+            'is_paginated': paginator.count > paginator.per_page,
+        }
+        if 'request' in context:
+            getvars = context['request'].GET.copy()
+            if 'page' in getvars:
+                del getvars['page']
+            if len(getvars.keys()) > 0:
+                to_return['getvars'] = "&%s" % getvars.urlencode()
+            else:
+                to_return['getvars'] = ''
+        return to_return
+    except KeyError, AttributeError:
+        return {}
+register.inclusion_tag('pagination/pagination.html', takes_context=True)(paginate)
+register.tag('autopaginate', do_autopaginate)
diff --git a/lib/pagination/tests.py b/lib/pagination/tests.py
new file mode 100644
index 0000000..647bbfd
--- /dev/null
+++ b/lib/pagination/tests.py
@@ -0,0 +1,61 @@
+"""
+>>> from django.core.paginator import Paginator
+>>> from pagination.templatetags.pagination_tags import paginate
+>>> from django.template import Template, Context
+
+>>> p = Paginator(range(15), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
+[1, 2, 3, 4, 5, 6, 7, 8]
+
+>>> p = Paginator(range(17), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
+[1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+>>> p = Paginator(range(19), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
+[1, 2, 3, 4, None, 7, 8, 9, 10]
+
+>>> p = Paginator(range(21), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
+[1, 2, 3, 4, None, 8, 9, 10, 11]
+
+# Testing orphans
+>>> p = Paginator(range(5), 2, 1)
+>>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
+[1, 2]
+
+>>> p = Paginator(range(21), 2, 1)
+>>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
+[1, 2, 3, 4, None, 7, 8, 9, 10]
+
+>>> t = Template("{% load pagination_tags %}{% autopaginate var 2 %}{% paginate %}")
+
+# WARNING: Please, please nobody read this portion of the code!
+>>> class GetProxy(object):
+...     def __iter__(self): yield self.__dict__.__iter__
+...     def copy(self): return self
+...     def urlencode(self): return u''
+...     def keys(self): return []
+>>> class RequestProxy(object):
+...     page = 1
+...     GET = GetProxy()
+>>>
+# ENDWARNING
+
+>>> t.render(Context({'var': range(21), 'request': RequestProxy()}))
+u'\\n\\n<div class="pagination">...
+>>>
+>>> t = Template("{% load pagination_tags %}{% autopaginate var %}{% paginate %}")
+>>> t.render(Context({'var': range(21), 'request': RequestProxy()}))
+u'\\n\\n<div class="pagination">...
+>>> t = Template("{% load pagination_tags %}{% autopaginate var 20 %}{% paginate %}")
+>>> t.render(Context({'var': range(21), 'request': RequestProxy()}))
+u'\\n\\n<div class="pagination">...
+>>> t = Template("{% load pagination_tags %}{% autopaginate var by %}{% paginate %}")
+>>> t.render(Context({'var': range(21), 'by': 20, 'request': RequestProxy()}))
+u'\\n\\n<div class="pagination">...
+>>> t = Template("{% load pagination_tags %}{% autopaginate var by as foo %}{{ foo }}")
+>>> t.render(Context({'var': range(21), 'by': 20, 'request': RequestProxy()}))
+u'[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]'
+>>>
+"""
\ No newline at end of file
diff --git a/notes/models.py b/notes/models.py
index 31b62cd..16984ec 100644
--- a/notes/models.py
+++ b/notes/models.py
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+from django.utils.translation import ugettext_lazy as _
 from django.db.models.signals import pre_save
 from django.contrib.auth.models import User
 from django.db import models
@@ -25,7 +26,7 @@ from snowy.notes.managers import NoteManager
 
 class Note(models.Model):
     NOTE_PERMISSIONS = (
-        (0, 'Private'), (1, 'Public'), 
+        (0, _(u'Private')), (1, _(u'Public')), 
     )
 
     guid = models.CharField(max_length=36)
diff --git a/notes/templates/notes/note_detail.html b/notes/templates/notes/note_detail.html
index 9a4d4d0..7823dd2 100644
--- a/notes/templates/notes/note_detail.html
+++ b/notes/templates/notes/note_detail.html
@@ -22,7 +22,7 @@
 {% for n in all_notes %}
         <li class="note-item{% if n.pinned %} pinned{% endif %}"><a href="{{ n.get_absolute_url }}">{{ n.title }}</a></li>
 {% endfor %}
-        <li class="more-item"><a href="#">{% trans "More Notes..." %}</a></li>
+        <li class="more-item"><a href="{% url note_list author.username %}">{% trans "More Notes..." %}</a></li>
     </ul>
     <hr />
     <ul>
diff --git a/notes/templates/notes/note_list.html b/notes/templates/notes/note_list.html
index 12e0d36..98152a1 100644
--- a/notes/templates/notes/note_list.html
+++ b/notes/templates/notes/note_list.html
@@ -1,14 +1,45 @@
 {% extends 'notes/base.html' %}
 
-{% block title %}Notes | {{ block.super }}{% endblock %}
-{% block body %}
+{% load i18n %}
+{% load humanize %}
+{% load pagination_tags %}
 
-{% if object_list %}
-    {% for object in object_list %}
-        <p><a href="{% url note_detail object.id %}">{{ object.title }}</a></p>
-    {% endfor %}
+{% block title %}{% trans "All Notes" %} | {{ block.super }}{% endblock %}
+
+{% block content-container %}
+<h1>{% trans "All Notes" %}</h1>
+<table class="object_list" cellspacing="0" cellpadding="0">
+    <thead>
+        <tr>
+            <th></th>
+            <th>{% trans "Title" %}</th>
+            <th>{% trans "Last Modified" %}</th>
+            <th>{% trans "Visibility" %}</th>
+        </tr>
+    </thead>
+    <tbody>
+{% autopaginate notes %}
+{% for note in notes %}
+        <tr class="{% cycle 'row-odd' 'row-even' %}">
+{% if note.pinned %}
+            <td class="icon"><img src="{{ MEDIA_URL }}img/pin-down_16.png" width="16" height="16" alt="Pinned"/></td>
 {% else %}
-No notes yet!
+            <td class="icon"><img src="{{ MEDIA_URL }}img/note_16.png" width="16" height="16" alt="Not pinned"/></td>
 {% endif %}
-
+            <td><a href="{{ note.get_absolute_url }}">{{ note.title }}</a></td>
+            <td>{{ note.user_modified|naturalday|title }}</td>
+            <td>{{ note.get_permissions_display }}</td>
+        </tr>
+{% endfor %}
+    </tbody>
+    <tfoot>
+        <tr>
+{% ifnotequal paginator.num_pages 1 %}
+            <td colspan="4">{% paginate %}</td>
+{% else %}
+            <td colspan="4">{% trans "Page 1 of 1" %}</td>
+{% endifnotequal %}
+        </tr>
+    </tfoot>
+</table>
 {% endblock %}
diff --git a/notes/urls.py b/notes/urls.py
index 51101b9..6bc35cc 100644
--- a/notes/urls.py
+++ b/notes/urls.py
@@ -20,6 +20,7 @@ from snowy.notes.models import Note
 
 urlpatterns = patterns('',
     url(r'^$', 'snowy.notes.views.note_index', name='note_index'),
+    url(r'^list/$', 'snowy.notes.views.note_list', name='note_list'),
     url(r'^(?P<note_id>\d+)/$', 'snowy.notes.views.note_detail', name='note_detail_no_slug'),
     url(r'^(?P<note_id>\d+)/(?P<slug>[^/]+)/$', 'snowy.notes.views.note_detail', name='note_detail'),
 )
diff --git a/notes/views.py b/notes/views.py
index f5b10aa..24b8ba4 100644
--- a/notes/views.py
+++ b/notes/views.py
@@ -17,6 +17,7 @@
 
 from django.http import HttpResponseRedirect, HttpResponseForbidden, Http404
 from django.shortcuts import render_to_response, get_object_or_404
+from django.core.paginator import Paginator
 from django.core.exceptions import ObjectDoesNotExist
 from django.core.urlresolvers import reverse
 from django.contrib.auth.models import User
@@ -41,6 +42,15 @@ def note_index(request, username,
                               {'author': author},
                               context_instance=RequestContext(request))
 
+def note_list(request, username,
+              template_name='notes/note_list.html'):
+    author = get_object_or_404(User, username=username)
+    notes = Note.objects.user_viewable(request.user, author) \
+                        .order_by('-user_modified')
+    return render_to_response(template_name,
+                              {'notes': notes},
+                              context_instance=RequestContext(request))
+
 def note_detail(request, username, note_id, slug='',
                 template_name='notes/note_detail.html'):
     def clean_content(xml, author):
diff --git a/settings.py b/settings.py
index 8b0ea42..68d6004 100644
--- a/settings.py
+++ b/settings.py
@@ -77,6 +77,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
     'django.core.context_processors.debug',
     'django.core.context_processors.i18n',
     'django.core.context_processors.media',
+    'django.core.context_processors.request',
     'snowy.core.context_processors.current_site',
 )
 
@@ -91,6 +92,7 @@ MIDDLEWARE_CLASSES = (
     'django.middleware.transaction.TransactionMiddleware',
     'reversion.middleware.RevisionMiddleware',
     'recaptcha_django.middleware.ReCaptchaMiddleware',
+    'pagination.middleware.PaginationMiddleware',
 )
 
 ROOT_URLCONF = 'snowy.urls'
@@ -122,6 +124,7 @@ INSTALLED_APPS = (
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
+    'django.contrib.humanize',
 
     # External apps
     'registration',
@@ -130,6 +133,7 @@ INSTALLED_APPS = (
     'gravatar',
     'autoslug',
     'piston',
+    'pagination',
 )
 
 # Maximum number of notes to show on the notes_detail list.
diff --git a/site_media/css/screen.css b/site_media/css/screen.css
index a5a8c48..b0ffbf3 100644
--- a/site_media/css/screen.css
+++ b/site_media/css/screen.css
@@ -83,7 +83,7 @@ td#sidebar-container {
 }
 
 #sidebar h3 {
-    font-family: Verdana, Candara, Tahmoa, Arial, sans-serif;
+    font-family: Verdana, Candara, Tahoma, Arial, sans-serif;
     text-transform: uppercase;
 }
 
@@ -322,3 +322,51 @@ table.input-form {
     font-size: 0.7em;
     vertical-align: top;
 }
+
+.object_list {
+    width: 800px;
+}
+
+.object_list thead tr {
+    background-color: #73685d;
+    font-family: Verdana, Candara, Tahoma, Arial, sans-serif;
+    text-transform: uppercase;
+    color: #FFFFFF;
+}
+
+.object_list tfoot tr {
+    background-color: #403b33;
+    text-align: center;
+    color: #ffffff;
+    height: 1.7em;
+}
+
+.object_list tfoot a {
+    color: #8ecbd2;
+}
+
+.object_list td {
+    padding: 5px 3px;
+}
+
+.row-even {
+    background-color: #d4e1d9;
+}
+
+.row-odd {
+    background-color: #edece6;
+}
+
+.object_list td.icon {
+    padding: 0;
+    text-align: center;
+}
+
+.object_list td.icon img {
+    vertical-align: middle;
+}
+
+.object_list div.paginator {
+    text-align: center;
+}
+
diff --git a/templates/base.html b/templates/base.html
index 8e2dfe7..a961ff3 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -44,20 +44,24 @@
                 </td>
             </tr>
         </table>
+{% block content-container %}
         <table id="content-container" cellspacing="0" cellpadding="0">
             <tr>
+{% block sidebar-container %}
                 <td id="sidebar-container">
                     <div id="sidebar">
 {% block sidebar %}
 {% endblock %}
                     </div>
                 </td>
+{% endblock %}
                 <td id="content">
 {% block content %}
 {% endblock %}
                 </td>
             </tr>
         </table>
+{% endblock %}
     </div>
 
     <div id="footer">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]