2 from datetime import date, datetime
4 from django.conf import settings
5 from django.conf.urls.defaults import url, patterns, include
6 from django.db import models
7 from django.http import Http404, HttpResponse
9 from philo.contrib.winer.models import FeedView
10 from philo.exceptions import ViewCanNotProvideSubpath
11 from philo.models import Tag, Entity, Page, register_value_model
12 from philo.models.fields import TemplateField
13 from philo.utils import paginate
17 """Represents a blog which can be posted to."""
18 #: The name of the :class:`Blog`, currently called 'title' for historical reasons.
19 title = models.CharField(max_length=255)
21 #: A slug used to identify the :class:`Blog`.
22 slug = models.SlugField(max_length=255)
24 def __unicode__(self):
29 """Returns a :class:`QuerySet` of :class:`.Tag`\ s that are used on any entries in this blog."""
30 return Tag.objects.filter(blogentries__blog=self).distinct()
33 def entry_dates(self):
34 """Returns a dictionary of date :class:`QuerySet`\ s for years, months, and days for which there are entries."""
35 dates = {'year': self.entries.dates('date', 'year', order='DESC'), 'month': self.entries.dates('date', 'month', order='DESC'), 'day': self.entries.dates('date', 'day', order='DESC')}
39 register_value_model(Blog)
42 class BlogEntry(Entity):
43 """Represents an entry in a :class:`Blog`."""
44 #: The title of the :class:`BlogEntry`.
45 title = models.CharField(max_length=255)
47 #: A slug which identifies the :class:`BlogEntry`.
48 slug = models.SlugField(max_length=255)
50 #: The :class:`Blog` which this entry has been posted to. Can be left blank to represent a "draft" status.
51 blog = models.ForeignKey(Blog, related_name='entries', blank=True, null=True)
53 #: A :class:`ForeignKey` to the author. The model is either :setting:`PHILO_PERSON_MODULE` or :class:`auth.User`.
54 author = models.ForeignKey(getattr(settings, 'PHILO_PERSON_MODULE', 'auth.User'), related_name='blogentries')
56 #: The date and time which the :class:`BlogEntry` is considered posted at.
57 date = models.DateTimeField(default=None)
59 #: The content of the :class:`BlogEntry`.
60 content = models.TextField()
62 #: An optional brief excerpt from the :class:`BlogEntry`.
63 excerpt = models.TextField(blank=True, null=True)
65 #: :class:`.Tag`\ s for this :class:`BlogEntry`.
66 tags = models.ManyToManyField(Tag, related_name='blogentries', blank=True, null=True)
68 def save(self, *args, **kwargs):
70 self.date = datetime.now()
71 super(BlogEntry, self).save(*args, **kwargs)
73 def __unicode__(self):
78 verbose_name_plural = "blog entries"
79 get_latest_by = "date"
82 register_value_model(BlogEntry)
85 class BlogView(FeedView):
87 A subclass of :class:`.FeedView` which handles patterns and feeds for a :class:`Blog` and its related :class:`entries <BlogEntry>`.
90 ENTRY_PERMALINK_STYLE_CHOICES = (
91 ('D', 'Year, month, and day'),
92 ('M', 'Year and month'),
98 #: The :class:`Blog` whose entries should be managed by this :class:`BlogView`
99 blog = models.ForeignKey(Blog, related_name='blogviews')
101 #: The main page of the :class:`Blog` will be rendered with this :class:`.Page`.
102 index_page = models.ForeignKey(Page, related_name='blog_index_related')
103 #: The detail view of a :class:`BlogEntry` will be rendered with this :class:`Page`.
104 entry_page = models.ForeignKey(Page, related_name='blog_entry_related')
105 # TODO: entry_archive is misleading. Rename to ymd_page or timespan_page.
106 #: Views of :class:`BlogEntry` archives will be rendered with this :class:`Page` (optional).
107 entry_archive_page = models.ForeignKey(Page, related_name='blog_entry_archive_related', null=True, blank=True)
108 #: Views of :class:`BlogEntry` archives according to their :class:`.Tag`\ s will be rendered with this :class:`Page`.
109 tag_page = models.ForeignKey(Page, related_name='blog_tag_related')
110 #: The archive of all available tags will be rendered with this :class:`Page` (optional).
111 tag_archive_page = models.ForeignKey(Page, related_name='blog_tag_archive_related', null=True, blank=True)
112 #: This number will be passed directly into pagination for :class:`BlogEntry` list pages. Pagination will be disabled if this is left blank.
113 entries_per_page = models.IntegerField(blank=True, null=True)
115 #: Depending on the needs of the site, different permalink styles may be appropriate. Example subpaths are provided for a :class:`BlogEntry` posted on May 2nd, 2011 with a slug of "hello". The choices are:
117 #: * Year, month, and day - ``2011/05/02/hello``
118 #: * Year and month - ``2011/05/hello``
119 #: * Year - ``2011/hello``
120 #: * Custom base - :attr:`entry_permalink_base`\ ``/hello``
121 #: * No base - ``hello``
122 entry_permalink_style = models.CharField(max_length=1, choices=ENTRY_PERMALINK_STYLE_CHOICES)
123 #: If the :attr:`entry_permalink_style` is set to "Custom base" then the value of this field will be used as the base subpath for year/month/day entry archive pages and entry detail pages. Default: "entries"
124 entry_permalink_base = models.CharField(max_length=255, blank=False, default='entries')
125 #: This will be used as the base for the views of :attr:`tag_page` and :attr:`tag_archive_page`. Default: "tags"
126 tag_permalink_base = models.CharField(max_length=255, blank=False, default='tags')
128 item_context_var = 'entries'
130 def __unicode__(self):
131 return u'BlogView for %s' % self.blog.title
133 def get_reverse_params(self, obj):
134 if isinstance(obj, BlogEntry):
135 if obj.blog_id == self.blog_id:
136 kwargs = {'slug': obj.slug}
137 if self.entry_permalink_style in 'DMY':
138 kwargs.update({'year': str(obj.date.year).zfill(4)})
139 if self.entry_permalink_style in 'DM':
140 kwargs.update({'month': str(obj.date.month).zfill(2)})
141 if self.entry_permalink_style == 'D':
142 kwargs.update({'day': str(obj.date.day).zfill(2)})
143 return self.entry_view, [], kwargs
144 elif isinstance(obj, Tag) or (isinstance(obj, models.query.QuerySet) and obj.model == Tag and obj):
145 if isinstance(obj, Tag):
147 slugs = [tag.slug for tag in obj if tag in self.get_tag_queryset(self.blog)]
149 return 'entries_by_tag', [], {'tag_slugs': "/".join(slugs)}
150 elif isinstance(obj, (date, datetime)):
152 'year': str(obj.year).zfill(4),
153 'month': str(obj.month).zfill(2),
154 'day': str(obj.day).zfill(2)
156 return 'entries_by_day', [], kwargs
157 raise ViewCanNotProvideSubpath
160 def urlpatterns(self):
161 urlpatterns = self.feed_patterns(r'^', 'get_entries', 'index_page', 'index') +\
162 self.feed_patterns(r'^%s/(?P<tag_slugs>[-\w]+[-+/\w]*)' % self.tag_permalink_base, 'get_entries', 'tag_page', 'entries_by_tag')
164 if self.tag_archive_page_id:
165 urlpatterns += patterns('',
166 url((r'^%s$' % self.tag_permalink_base), self.tag_archive_view, name='tag_archive')
169 if self.entry_archive_page_id:
170 if self.entry_permalink_style in 'DMY':
171 urlpatterns += self.feed_patterns(r'^(?P<year>\d{4})', 'get_entries', 'entry_archive_page', 'entries_by_year')
172 if self.entry_permalink_style in 'DM':
173 urlpatterns += self.feed_patterns(r'^(?P<year>\d{4})/(?P<month>\d{2})', 'get_entries', 'entry_archive_page', 'entries_by_month')
174 if self.entry_permalink_style == 'D':
175 urlpatterns += self.feed_patterns(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})', 'get_entries', 'entry_archive_page', 'entries_by_day')
177 if self.entry_permalink_style == 'D':
178 urlpatterns += patterns('',
179 url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)$', self.entry_view)
181 elif self.entry_permalink_style == 'M':
182 urlpatterns += patterns('',
183 url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', self.entry_view)
185 elif self.entry_permalink_style == 'Y':
186 urlpatterns += patterns('',
187 url(r'^(?P<year>\d{4})/(?P<slug>[-\w]+)$', self.entry_view)
189 elif self.entry_permalink_style == 'B':
190 urlpatterns += patterns('',
191 url((r'^%s/(?P<slug>[-\w]+)$' % self.entry_permalink_base), self.entry_view)
194 urlpatterns += patterns('',
195 url(r'^(?P<slug>[-\w]+)$', self.entry_view)
199 def get_entry_queryset(self, obj):
200 """Returns the default :class:`QuerySet` of :class:`BlogEntry` instances for the :class:`BlogView` - all entries that are considered posted in the past. This allows for scheduled posting of entries."""
201 return obj.entries.filter(date__lte=datetime.now())
203 def get_tag_queryset(self, obj):
204 """Returns the default :class:`QuerySet` of :class:`.Tag`\ s for the :class:`BlogView`'s :meth:`get_entries_by_tag` and :meth:`tag_archive_view`."""
205 return obj.entry_tags
207 def get_object(self, request, year=None, month=None, day=None, tag_slugs=None):
208 """Returns a dictionary representing the parameters for a feed which will be exposed."""
209 if tag_slugs is None:
212 tag_slugs = tag_slugs.replace('+', '/').split('/')
213 tags = self.get_tag_queryset(self.blog).filter(slug__in=tag_slugs)
217 # Raise a 404 on an incorrect slug.
218 found_slugs = set([tag.slug for tag in tags])
219 for slug in tag_slugs:
220 if slug and slug not in found_slugs:
224 if year and month and day:
225 context_date = date(int(year), int(month), int(day))
227 context_date = date(int(year), int(month), 1)
229 context_date = date(int(year), 1, 1)
232 except TypeError, ValueError:
244 def get_entries(self, obj, request, year=None, month=None, day=None, tag_slugs=None, extra_context=None):
245 """Returns the :class:`BlogEntry` objects which will be exposed for the given object, as returned from :meth:`get_object`."""
246 entries = self.get_entry_queryset(obj['blog'])
248 if obj['tags'] is not None:
251 entries = entries.filter(tags=tag)
253 if obj['date'] is not None:
255 entries = entries.filter(date__year=year)
257 entries = entries.filter(date__month=month)
259 entries = entries.filter(date__day=day)
261 context = extra_context or {}
264 return entries, context
266 def entry_view(self, request, slug, year=None, month=None, day=None, extra_context=None):
267 """Renders :attr:`entry_page` with the entry specified by the given parameters."""
268 entries = self.get_entry_queryset(self.blog)
270 entries = entries.filter(date__year=year)
272 entries = entries.filter(date__month=month)
274 entries = entries.filter(date__day=day)
276 entry = entries.get(slug=slug)
279 context = self.get_context()
280 context.update(extra_context or {})
281 context.update({'entry': entry})
282 return self.entry_page.render_to_response(request, extra_context=context)
284 def tag_archive_view(self, request, extra_context=None):
285 """Renders :attr:`tag_archive_page` with the result of :meth:`get_tag_queryset` added to the context."""
286 if not self.tag_archive_page:
288 context = self.get_context()
289 context.update(extra_context or {})
291 'tags': self.get_tag_queryset(self.blog)
293 return self.tag_archive_page.render_to_response(request, extra_context=context)
295 def process_page_items(self, request, items):
296 """Overrides :meth:`.FeedView.process_page_items` to add pagination."""
297 if self.entries_per_page:
298 page_num = request.GET.get('page', 1)
299 paginator, paginated_page, items = paginate(items, self.entries_per_page, page_num)
301 'paginator': paginator,
302 'paginated_page': paginated_page,
303 self.item_context_var: items
307 self.item_context_var: items
309 return items, item_context
311 def title(self, obj):
312 title = obj['blog'].title
314 title += u" – %s" % u", ".join((tag.name for tag in obj['tags']))
318 datestr = date.strftime("%F %j, %Y")
320 datestr = date.strftime("%F, %Y")
322 datestr = date.strftime("%Y")
323 title += u" – %s" % datestr
326 def categories(self, obj):
329 return (tag.name for tag in tags)
332 def item_title(self, item):
335 def item_description(self, item):
338 def item_author_name(self, item):
339 return item.author.get_full_name()
341 def item_pubdate(self, item):
344 def item_categories(self, item):
345 return [tag.name for tag in item.tags.all()]
348 class Newsletter(Entity):
349 """Represents a newsletter which will contain :class:`articles <NewsletterArticle>` organized into :class:`issues <NewsletterIssue>`."""
350 #: The name of the :class:`Newsletter`, currently callse 'title' for historical reasons.
351 title = models.CharField(max_length=255)
352 #: A slug used to identify the :class:`Newsletter`.
353 slug = models.SlugField(max_length=255)
355 def __unicode__(self):
359 register_value_model(Newsletter)
362 class NewsletterArticle(Entity):
363 """Represents an article in a :class:`Newsletter`"""
364 #: The title of the :class:`NewsletterArticle`.
365 title = models.CharField(max_length=255)
366 #: A slug which identifies the :class:`NewsletterArticle`.
367 slug = models.SlugField(max_length=255)
368 #: A :class:`ForeignKey` to :class:`Newsletter` representing the newsletter which this article was written for.
369 newsletter = models.ForeignKey(Newsletter, related_name='articles')
370 #: A :class:`ManyToManyField` to the author(s) of the :class:`NewsletterArticle`. The model is either :setting:`PHILO_PERSON_MODULE` or :class:`auth.User`.
371 authors = models.ManyToManyField(getattr(settings, 'PHILO_PERSON_MODULE', 'auth.User'), related_name='newsletterarticles')
372 #: The date and time which the :class:`NewsletterArticle` is considered published at.
373 date = models.DateTimeField(default=None)
374 #: A :class:`.TemplateField` containing an optional short summary of the article, meant to grab a reader's attention and draw them in.
375 lede = TemplateField(null=True, blank=True, verbose_name='Summary')
376 #: A :class:`.TemplateField` containing the full text of the article.
377 full_text = TemplateField(db_index=True)
378 #: A :class:`ManyToManyField` to :class:`.Tag`\ s for the :class:`NewsletterArticle`.
379 tags = models.ManyToManyField(Tag, related_name='newsletterarticles', blank=True, null=True)
381 def save(self, *args, **kwargs):
382 if self.date is None:
383 self.date = datetime.now()
384 super(NewsletterArticle, self).save(*args, **kwargs)
386 def __unicode__(self):
390 get_latest_by = 'date'
392 unique_together = (('newsletter', 'slug'),)
395 register_value_model(NewsletterArticle)
398 class NewsletterIssue(Entity):
399 """Represents an issue of the newsletter."""
400 #: The title of the :class:`NewsletterIssue`.
401 title = models.CharField(max_length=255)
402 #: A slug which identifies the :class:`NewsletterIssue`.
403 slug = models.SlugField(max_length=255)
404 #: A :class:`ForeignKey` to the :class:`Newsletter` which this issue belongs to.
405 newsletter = models.ForeignKey(Newsletter, related_name='issues')
406 #: The numbering of the issue - for example, 04.02 for volume 4, issue 2. This is an instance of :class:`CharField` to allow any arbitrary numbering system.
407 numbering = models.CharField(max_length=50, help_text='For example, 04.02 for volume 4, issue 2.')
408 #: A :class:`ManyToManyField` to articles belonging to this issue.
409 articles = models.ManyToManyField(NewsletterArticle, related_name='issues')
411 def __unicode__(self):
415 ordering = ['-numbering']
416 unique_together = (('newsletter', 'numbering'),)
419 register_value_model(NewsletterIssue)
422 class NewsletterView(FeedView):
423 """A subclass of :class:`.FeedView` which handles patterns and feeds for a :class:`Newsletter` and its related :class:`articles <NewsletterArticle>`."""
424 ARTICLE_PERMALINK_STYLE_CHOICES = (
425 ('D', 'Year, month, and day'),
426 ('M', 'Year and month'),
431 #: A :class:`ForeignKey` to the :class:`Newsletter` managed by this :class:`NewsletterView`.
432 newsletter = models.ForeignKey(Newsletter, related_name='newsletterviews')
434 #: A :class:`ForeignKey` to the :class:`Page` used to render the main page of this :class:`NewsletterView`.
435 index_page = models.ForeignKey(Page, related_name='newsletter_index_related')
436 #: A :class:`ForeignKey` to the :class:`Page` used to render the detail view of a :class:`NewsletterArticle` for this :class:`NewsletterView`.
437 article_page = models.ForeignKey(Page, related_name='newsletter_article_related')
438 #: A :class:`ForeignKey` to the :class:`Page` used to render the :class:`NewsletterArticle` archive pages for this :class:`NewsletterView`.
439 article_archive_page = models.ForeignKey(Page, related_name='newsletter_article_archive_related', null=True, blank=True)
440 #: A :class:`ForeignKey` to the :class:`Page` used to render the detail view of a :class:`NewsletterIssue` for this :class:`NewsletterView`.
441 issue_page = models.ForeignKey(Page, related_name='newsletter_issue_related')
442 #: A :class:`ForeignKey` to the :class:`Page` used to render the :class:`NewsletterIssue` archive pages for this :class:`NewsletterView`.
443 issue_archive_page = models.ForeignKey(Page, related_name='newsletter_issue_archive_related', null=True, blank=True)
445 #: Depending on the needs of the site, different permalink styles may be appropriate. Example subpaths are provided for a :class:`NewsletterArticle` posted on May 2nd, 2011 with a slug of "hello". The choices are:
447 #: * Year, month, and day - :attr:`article_permalink_base`\ ``/2011/05/02/hello``
448 #: * Year and month - :attr:`article_permalink_base`\ ``/2011/05/hello``
449 #: * Year - :attr:`article_permalink_base`\ ``/2011/hello``
450 #: * Slug only - :attr:`article_permalink_base`\ ``/hello``
451 article_permalink_style = models.CharField(max_length=1, choices=ARTICLE_PERMALINK_STYLE_CHOICES)
452 #: This will be used as the base subpath for year/month/day article archive pages and article detail pages. Default: "articles"
453 article_permalink_base = models.CharField(max_length=255, blank=False, default='articles')
454 #: This will be used as the base subpath for issue detail pages and the issue archive page.
455 issue_permalink_base = models.CharField(max_length=255, blank=False, default='issues')
457 item_context_var = 'articles'
458 object_attr = 'newsletter'
460 def __unicode__(self):
461 return "NewsletterView for %s" % self.newsletter.__unicode__()
463 def get_reverse_params(self, obj):
464 if isinstance(obj, NewsletterArticle):
465 if obj.newsletter_id == self.newsletter_id:
466 kwargs = {'slug': obj.slug}
467 if self.article_permalink_style in 'DMY':
468 kwargs.update({'year': str(obj.date.year).zfill(4)})
469 if self.article_permalink_style in 'DM':
470 kwargs.update({'month': str(obj.date.month).zfill(2)})
471 if self.article_permalink_style == 'D':
472 kwargs.update({'day': str(obj.date.day).zfill(2)})
473 return self.article_view, [], kwargs
474 elif isinstance(obj, NewsletterIssue):
475 if obj.newsletter_id == self.newsletter_id:
476 return 'issue', [], {'numbering': obj.numbering}
477 elif isinstance(obj, (date, datetime)):
479 'year': str(obj.year).zfill(4),
480 'month': str(obj.month).zfill(2),
481 'day': str(obj.day).zfill(2)
483 return 'articles_by_day', [], kwargs
484 raise ViewCanNotProvideSubpath
487 def urlpatterns(self):
488 urlpatterns = self.feed_patterns(r'^', 'get_all_articles', 'index_page', 'index') + patterns('',
489 url(r'^%s/(?P<numbering>.+)$' % self.issue_permalink_base, self.page_view('get_articles_by_issue', 'issue_page'), name='issue')
491 if self.issue_archive_page_id:
492 urlpatterns += patterns('',
493 url(r'^%s$' % self.issue_permalink_base, self.issue_archive_view, 'issue_archive')
495 if self.article_archive_page_id:
496 urlpatterns += self.feed_patterns(r'^%s' % self.article_permalink_base, 'get_all_articles', 'article_archive_page', 'articles')
497 if self.article_permalink_style in 'DMY':
498 urlpatterns += self.feed_patterns(r'^%s/(?P<year>\d{4})' % self.article_permalink_base, 'get_articles_by_ymd', 'article_archive_page', 'articles_by_year')
499 if self.article_permalink_style in 'DM':
500 urlpatterns += self.feed_patterns(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})' % self.article_permalink_base, 'get_articles_by_ymd', 'article_archive_page', 'articles_by_month')
501 if self.article_permalink_style == 'D':
502 urlpatterns += self.feed_patterns(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})' % self.article_permalink_base, 'get_articles_by_ymd', 'article_archive_page', 'articles_by_day')
504 if self.article_permalink_style == 'Y':
505 urlpatterns += patterns('',
506 url(r'^%s/(?P<year>\d{4})/(?P<slug>[\w-]+)$' % self.article_permalink_base, self.article_view)
508 elif self.article_permalink_style == 'M':
509 urlpatterns += patterns('',
510 url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[\w-]+)$' % self.article_permalink_base, self.article_view)
512 elif self.article_permalink_style == 'D':
513 urlpatterns += patterns('',
514 url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)$' % self.article_permalink_base, self.article_view)
517 urlpatterns += patterns('',
518 url(r'^%s/(?P<slug>[-\w]+)$' % self.article_permalink_base, self.article_view)
523 def get_context(self):
524 return {'newsletter': self.newsletter}
526 def get_article_queryset(self, obj):
527 """Returns the default :class:`QuerySet` of :class:`NewsletterArticle` instances for the :class:`NewsletterView` - all articles that are considered posted in the past. This allows for scheduled posting of articles."""
528 return obj.articles.filter(date__lte=datetime.now())
530 def get_issue_queryset(self, obj):
531 """Returns the default :class:`QuerySet` of :class:`NewsletterIssue` instances for the :class:`NewsletterView`."""
532 return obj.issues.all()
534 def get_all_articles(self, obj, request, extra_context=None):
535 """Used to generate :meth:`~.FeedView.feed_patterns` for all entries."""
536 return self.get_article_queryset(obj), extra_context
538 def get_articles_by_ymd(self, obj, request, year, month=None, day=None, extra_context=None):
539 """Used to generate :meth:`~.FeedView.feed_patterns` for a specific year, month, and day."""
540 articles = self.get_article_queryset(obj).filter(date__year=year)
542 articles = articles.filter(date__month=month)
544 articles = articles.filter(date__day=day)
545 return articles, extra_context
547 def get_articles_by_issue(self, obj, request, numbering, extra_context=None):
548 """Used to generate :meth:`~.FeedView.feed_patterns` for articles from a certain issue."""
550 issue = self.get_issue_queryset(obj).get(numbering=numbering)
551 except NewsletterIssue.DoesNotExist:
553 context = extra_context or {}
554 context.update({'issue': issue})
555 return self.get_article_queryset(obj).filter(issues=issue), context
557 def article_view(self, request, slug, year=None, month=None, day=None, extra_context=None):
558 """Renders :attr:`article_page` with the article specified by the given parameters."""
559 articles = self.get_article_queryset(self.newsletter)
561 articles = articles.filter(date__year=year)
563 articles = articles.filter(date__month=month)
565 articles = articles.filter(date__day=day)
567 article = articles.get(slug=slug)
568 except NewsletterArticle.DoesNotExist:
570 context = self.get_context()
571 context.update(extra_context or {})
572 context.update({'article': article})
573 return self.article_page.render_to_response(request, extra_context=context)
575 def issue_archive_view(self, request, extra_context):
576 """Renders :attr:`issue_archive_page` with the result of :meth:`get_issue_queryset` added to the context."""
577 if not self.issue_archive_page:
579 context = self.get_context()
580 context.update(extra_context or {})
582 'issues': self.get_issue_queryset(self.newsletter)
584 return self.issue_archive_page.render_to_response(request, extra_context=context)
586 def title(self, obj):
589 def item_title(self, item):
592 def item_description(self, item):
593 return item.full_text
595 def item_author_name(self, item):
596 authors = list(item.authors.all())
598 return "%s and %s" % (", ".join([author.get_full_name() for author in authors[:-1]]), authors[-1].get_full_name())
600 return authors[0].get_full_name()
604 def item_pubdate(self, item):
607 def item_categories(self, item):
608 return [tag.name for tag in item.tags.all()]