Example #1
0
File: tests.py Project: srosro/dlog
 def test_entries_published(self):
     self.assertEquals(entries_published(Entry.objects.all()).count(), 1)
     self.entry_2.status = PUBLISHED
     self.entry_2.save()
     self.assertEquals(entries_published(Entry.objects.all()).count(), 2)
     self.entry_1.sites.clear()
     self.assertEquals(entries_published(Entry.objects.all()).count(), 1)
     self.entry_1.sites.add(*self.sites)
     self.entry_1.start_publication = datetime(2020, 1, 1)
     self.entry_1.save()
     self.assertEquals(entries_published(Entry.objects.all()).count(), 1)
     self.entry_1.start_publication = datetime(2000, 1, 1)
     self.entry_1.save()
     self.assertEquals(entries_published(Entry.objects.all()).count(), 2)
     self.entry_1.end_publication = datetime(2000, 1, 1)
     self.entry_1.save()
     self.assertEquals(entries_published(Entry.objects.all()).count(), 1)
     self.entry_1.end_publication = datetime(2020, 1, 1)
     self.entry_1.save()
     self.assertEquals(entries_published(Entry.objects.all()).count(), 2)
Example #2
0
 def related_published_set(self):
     """Return only related entries published"""
     return entries_published(self.related)
Example #3
0
File: feeds.py Project: srosro/dlog
 def items(self, obj):
     return entries_published(obj.entry_set)
Example #4
0
 def lastmod(self, obj):
     entries = entries_published(obj.entry_set)
     if not entries:
         return None
     return entries[0].creation_date
Example #5
0
def author_detail(request, username, page=None):
    """Display the entries of an author"""
    author = get_object_or_404(User, username=username)
    return object_list(request, queryset=entries_published(author.entry_set),
                       paginate_by=PAGINATION, page=page,
                       extra_context={'author': author})