- def post_view(self, request, year=None, month=None, day=None, slug=None):
- raise Http404
+ def entry_view(self, request, slug, year=None, month=None, day=None):
+ entries = self.entries.all()
+ if year:
+ entries = entries.filter(date__year=year)
+ if month:
+ entries = entries.filter(date__month=month)
+ if day:
+ entries = entries.filter(date__day=day)
+ try:
+ entry = entries.get(slug=slug)
+ except:
+ raise Http404
+ return HttpResponse(self.entry_template.django_template.render(RequestContext(request, {'blog': self, 'entry': entry})), mimetype=self.entry_template.mimetype)
+
+
+class BlogEntry(Entity, TitledContent):
+ blog = models.ForeignKey(Blog, related_name='entries')
+ author = models.ForeignKey(User, related_name='blogentries')
+ date = models.DateTimeField(default=datetime.now)
+
+
+register_value_model(BlogEntry)
\ No newline at end of file