Skip to content

Commit

Permalink
Version 0.9.3: added an owners_list property
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Feb 20, 2012
1 parent 94d1e1d commit 3a79194
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/settings.py
Expand Up @@ -90,7 +90,7 @@
)
VIEWPOINT_SETTINGS = {
'BLOG_RELATION_MODELS': ('flatpages.flatpage',),
'DEFAULT_BLOG': 'default',
# 'DEFAULT_BLOG': 'default',
# 'USE_APPROVAL': True,
# 'USE_CATEGORIES': True,
# 'DEFAULT_STORAGE' = 'media_storage.MediaStorage'
Expand Down
2 changes: 1 addition & 1 deletion viewpoint/__init__.py
@@ -1,7 +1,7 @@
__version_info__ = {
'major': 0,
'minor': 9,
'micro': 2,
'micro': 3,
'releaselevel': 'final',
'serial': 1
}
Expand Down
12 changes: 12 additions & 0 deletions viewpoint/models.py
Expand Up @@ -140,6 +140,18 @@ def get_absolute_url(self):
else:
return ('viewpoint_blog_detail', None, {'blog_slug': self.slug})

@property
def owners_list(self):
"""
Print out the owners in a nice list
"""
owner_list = [unicode(o) for o in self.owners.all()]

if len(owner_list) > 1:
return "%s and %s" % (", ".join(owner_list[:-1]), owner_list[-1])
else:
return owner_list[0]

class Meta:
ordering = ('title',)
get_latest_by = 'creation_date'
Expand Down
2 changes: 1 addition & 1 deletion viewpoint/templates/viewpoint/blog_detail.html
Expand Up @@ -3,7 +3,7 @@
<h1>{{ object.title }}</h1>
<p>{{ object.description }}</p>
<h2>Entries</h2>

<p>Owners: {{ object.owners_list}}</p>
<ul>
{% for entry in object.entry_set.published %}
<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li>
Expand Down

0 comments on commit 3a79194

Please sign in to comment.