Skip to content
This repository has been archived by the owner on Sep 3, 2019. It is now read-only.

Commit

Permalink
did some work.
Browse files Browse the repository at this point in the history
  • Loading branch information
myles committed Jul 30, 2013
1 parent ad98d09 commit 5deb747
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 52 deletions.
49 changes: 0 additions & 49 deletions blog/views/archive.py
Expand Up @@ -72,7 +72,6 @@ def get(self, request, year, month, *args, **kwargs):
except ValueError:
raise Http404

<<<<<<< HEAD
posts = Post.objects.archive_month(date).select_related()

first_day = date.replace(day=1)
Expand Down Expand Up @@ -109,54 +108,6 @@ def get(self, request, year, week, *args, **kwargs):

class BlogPostDayArchiveView(TemplateResponseMixin, ContextMixin, View):

=======
class BlogPostWeekArchiveView(ListView):

context_object_name = "post_list"
template_name = "blog/archive/week.html"
paginate_by = BLOG_PAGINATE_BY

def get_context_data(self, **kwargs):
context = super(BlogPostWeekArchiveView, self).get_context_data(**kwargs)
context['this_week'] = self.this_week
context['next_week'] = self.this_week + datetime.timedelta(days=8)
context['prev_week'] = self.this_week - datetime.timedelta(days=-8)
return context

def get_queryset(self):
try:
tt = time.strptime(self.kwargs['year']+'-0-'+self.kwargs['week'], '%Y-%W-%U')
self.this_week = datetime.date(*tt[:3])
except ValueError:
raise Http404

first_day = self.this_week
last_day = first_day + datetime.timedelta(days=7)

return Post.objects.archive_week(first_day, last_day).select_related()

class BlogPostWeekDayArchiveView(ListView):

context_object_name = "post_list"
template_name = "blog/archive/day.html"
paginate_by = BLOG_PAGINATE_BY

def get_context_data(self, **kwargs):
context = super(BlogPostWeekDayArchiveView, self).get_context_data(**kwargs)

return context

def get_queryset(self):
try:
self.this_day = datetime.date(*time.strptime("%s-%s-%s" % (self.kwargs['year'], self.kwargs['week'], self.kwargs['weekday']), '%Y-%U-%a')[:3])
except ValueError:
raise Http404

return Post.objects.archive_day(self.this_day).select_related()

class BlogPostDayArchiveView(ListView):
context_object_name = "post_list"
>>>>>>> Working on the week views.
template_name = "blog/archive/day.html"

def get(self, request, year, month, day, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion blog/views/author.py
Expand Up @@ -11,7 +11,7 @@
]

class BlogPostAuthorListView(TemplateResponseMixin, ContextMixin, View):

template_name = "blog/author/list.html"

def get(self, request, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion blog/views/category.py
Expand Up @@ -10,7 +10,7 @@
]

class BlogCategoryListView(TemplateResponseMixin, ContextMixin, View):

template_name = "blog/category/list.html"

def get(self, request, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion blog/views/search.py
Expand Up @@ -12,7 +12,7 @@
]

class BlogPostSearchFormListView(TemplateResponseMixin, ContextMixin, View):

template_name = "blog/search.html"

def get(self, request, *args, **kwargs):
Expand Down

0 comments on commit 5deb747

Please sign in to comment.