+ feed_suffix = models.CharField(max_length=255, blank=False, default=FeedMultiViewMixin.feed_suffix)
+ feeds_enabled = models.BooleanField()
+ list_var = 'articles'
+
+ def __unicode__(self):
+ return self.newsletter.__unicode__()
+
+ def get_reverse_params(self, obj):
+ if isinstance(obj, NewsletterArticle):
+ if obj.newsletter == self.newsletter:
+ kwargs = {'slug': obj.slug}
+ if self.article_permalink_style in 'DMY':
+ kwargs.update({'year': str(obj.date.year).zfill(4)})
+ if self.article_permalink_style in 'DM':
+ kwargs.update({'month': str(obj.date.month).zfill(2)})
+ if self.article_permalink_style == 'D':
+ kwargs.update({'day': str(obj.date.day).zfill(2)})
+ return self.article_view, [], kwargs
+ elif isinstance(obj, NewsletterIssue):
+ if obj.newsletter == self.newsletter:
+ return 'issue', [], {'numbering': obj.numbering}
+ elif isinstance(obj, (date, datetime)):
+ kwargs = {
+ 'year': str(obj.year).zfill(4),
+ 'month': str(obj.month).zfill(2),
+ 'day': str(obj.day).zfill(2)
+ }
+ return 'articles_by_day', [], kwargs
+ raise ViewCanNotProvideSubpath
+