def post_archive(request, year, month=None, day=None, **kwargs): queryset = Post.objects.published() if day is not None: return date_based.archive_day(request, year=year, month=month, day=day, date_field='pub_date', month_format='%m', queryset=queryset, **kwargs) elif month is not None: return date_based.archive_month(request, year=year, month=month, date_field='pub_date', month_format='%m', queryset=queryset, **kwargs) else: return date_based.archive_year(request, year=year, date_field='pub_date', queryset=queryset, make_object_list=True, **kwargs)
def category_archive_day(request, slug, year, month, day, **kwargs): """ View of entries published in a ``Category`` on a given day. This is a short wrapper around the generic ``date_based.archive_day`` view, so all context variables populated by that view will be available here. One extra variable is added:: object The ``Category``. Additionally, any keyword arguments which are valid for ``date_based.archive_day`` will be accepted and passed to it, with these exceptions: * ``queryset`` will always be the ``QuerySet`` of live entries in the ``Category``. * ``date_field`` will always be 'pub_date'. * ``template_name`` will always be 'coltrane/category_archive_day.html'. Template:: coltrane/category_archive_day.html """ category = get_object_or_404(Category, slug__exact=slug) kwarg_dict = _category_kwarg_helper(category, kwargs) return date_based.archive_day(request, year=year, month=month, day=day, queryset=category.live_entry_set, date_field='pub_date', template_name='coltrane/category_archive_day.html', **kwarg_dict)
def post_archive(request, year, month=None, day=None, **kwargs): queryset = Post.objects.published() if day is not None: return date_based.archive_day( request, year=year, month=month, day=day, date_field='pub_date', month_format = '%m', queryset=queryset, **kwargs ) elif month is not None: return date_based.archive_month( request, year=year, month=month, date_field='pub_date', month_format = '%m', queryset=queryset, **kwargs ) else: return date_based.archive_year( request, year=year, date_field='pub_date', queryset=queryset, make_object_list=True, **kwargs )
def archive_day(request, year, month, day): if int(year) < 1901: raise Http404 qs = Post.objects.filter(site=Site.objects.get_current()) return date_based.archive_day(request, year, month, day, month_format='%m', template_name='blog/post_archive_year.html', queryset=qs, **archive_dict)
def friends_archive_day(request, year, month, day): """ Post archive day Templates: ``friends/index.html`` Context: object_list: list of objects published that day day: (datetime) the day previous_day (datetime) the previous day next_day (datetime) the next day, or None if the current day is today """ return date_based.archive_day( request, year=year, month=month, month_format='%m', day=day, date_field='posted', queryset=FriendPost.objects.active(), template_name='friends/index.html' )
def article_archive_day(request, year, month, day): kwargs = { 'queryset': Article.objects.published(), 'date_field': 'publish_at', 'month_format': '%m', } return date_based.archive_day(request, year=year, month=month, day=day, **kwargs)
def blog_archive_day(request, **kwargs): blog_slug = kwargs.pop('blog_slug') kwargs['queryset'] = kwargs['queryset'].published().filter( blog__slug=blog_slug) set_language_changer(request, language_changer) return archive_day(request, extra_context={ 'blog_slug': blog_slug }, **kwargs)
def tumble_archive_day(request, year, month, day, content_type=None, template_name=None, **kwargs): queryset = TumbleItem.objects.all() if content_type: queryset = queryset.filter(content_type__name=content_type) select_template_name = select_template([ template_name or '', 'djumblr/%s_list.html' % (content_type), 'djumblr/tumbleitem_list.html', ]) template_name = select_template_name.name if 'extra_context' not in kwargs: kwargs['extra_context'] = {} kwargs['extra_context']['content_type'] = content_type return date_based.archive_day( request, year = year, month = month, day = day, date_field = 'pub_date', queryset = queryset, template_name = template_name, **kwargs )
def event_day(request, year=None, month=None, day=None, **kwargs): """Displays the list of calendar for the given day. """ current_day = _current_day(year, month, day) previous_day = current_day - datetime.timedelta(1) next_day = current_day + datetime.timedelta(1) return archive_day( request, year=year, month=month, day=day, queryset=Event.objects.for_user(request.user), date_field="start", month_format="%m", allow_empty=True, allow_future=True, template_name="calendar/event_day.html", extra_context={ 'previous_day': previous_day, 'next_day': next_day, 'current_day': current_day }, **kwargs )
def blog_archive_day(request, **kwargs): blog_slug = kwargs.pop('blog_slug') kwargs['queryset'] = kwargs['queryset'].published().filter( blog__slug=blog_slug) set_language_changer(request, language_changer) return archive_day(request, extra_context={'blog_slug': blog_slug}, **kwargs)
def entry_archive_day(request, *args, **kwargs): """ A thin wrapper around ``django.views.generic.date_based.archive_day``. """ kwargs['date_field'] = 'pub_date' if 'queryset' not in kwargs: kwargs['queryset'] = Entry.published_on_site.all() return date_based.archive_day(request, *args, **kwargs)
def post_archive_day(request, year, month, day, **kwargs): return date_based.archive_day(request, year=year, month=month, day=day, date_field='publish', queryset=Post.objects.published(), **kwargs)
def archive_day(self, request, year, month, day, extra_context=None): queryset = self.get_queryset(request) extra_context = extra_context or {} extra_context.update({ 'configuration': self }) return archive_day(request, year, month, day, queryset, 'pub_date', template_object_name=self.template_object_name, extra_context=extra_context, template_name=self.archive_day_template_name)
def article_archive_day(request, year, month, day): return date_based.archive_day( request, year=year, month=month, day=day, date_field='release_date', queryset=models.Article.objects.get_published(), )
def archive_day(request, year, month, day): """ Return the articles of that day """ return date_based.archive_day(request, year=year, month=month, day=day, date_field='published_at', template_object_name='article', queryset=Article.publish.all())
def bookmark_archive_day(request, year, month, day): return date_based.archive_day( request, year=year, month=month, day=day, date_field='created', queryset=Bookmark.objects.published(), )
def archive_day(request, year, month, day): return date_based.archive_day(request, queryset=Post.objects.published(), date_field='post_date', year=year, month=month, month_format="%m", day=day, template_object_name='post')
def post_archive_day(request, year, month, day): return date_based.archive_day( request, year = year, month = month, day = day, date_field = 'publish', queryset = Post.objects.published(), )
def bookmark_archive_day(request, year, month, day): return date_based.archive_day( request, year=year, month=month, day=day, date_field="save_date", template_object_name="bookmark", queryset=Bookmark.shared_objects.all(), )
def event_archive_day(request, year, month, day): return date_based.archive_day( request, year=year, month=month, day=day, date_field='start', queryset=EventTime.objects.all(), allow_future=True, )
def blog_archive_day(request, blog_slug, year, month, day): blog = get_object_or_404(Blog, slug=blog_slug) return date_based.archive_day(request, year = year, month = month, day = day, queryset = blog.entry_set.all(), date_field = 'pub_date', extra_context = {'blog': blog}, template_name = blog.template_name_date_archive or 'blogs/entry_archive_day.html')
def entry_archive_day(request, year, month, day, **kwargs): return date_based.archive_day( request, year=year, month=month, day=day, date_field="pub_date", month_format="%m", queryset=Entry.objects.published(), **kwargs )
def post_archive_day(request, year, month, day, **kwargs): return date_based.archive_day( request, year=year, month=month, month_format='%m', day=day, date_field='publish', queryset=Post.objects.published(), **kwargs )
def article_archive_day(request, year, month, day, **kwargs): return date_based.archive_day( request, year = year, month = month, day = day, month_format='%m', date_field = 'pub_date', queryset = Article.objects.published(), **kwargs )
def insta_post_archive_day(request, year, month, day, **kwargs): return date_based.archive_day( request, year=year, month=month, day=day, date_field='publish', month_format='%m', queryset=Post.objects.published(), template_name='InstauratioMagna/post_archive.html', **kwargs )
def Loading_post_archive_day(request, year, month, day, **kwargs): return date_based.archive_day( request, year=year, month=month, day=day, date_field='publish', month_format='%m', queryset=Post.objects.published(), template_name='LoadingBlog/post_archive.html', **kwargs )
def archive_day(self, request, entry_queryset=None, *args, **kwargs): if entry_queryset is not None: queryset = entry_queryset else: queryset = self.entry_queryset info_dict = { 'queryset': queryset, 'date_field': 'pub_date', 'template_name': '%s/entry_archive_day.html' % self.template_root_path, 'template_object_name': 'entry', } return date_based.archive_day(request, *args, **dict(info_dict, month_format='%m', **kwargs))
def event_archive_day(request, year, month, day): return date_based.archive_day( request, year, month, day, Event.objects.for_user(request.user), DATEFIELD, month_format=MONTH_FORMAT, allow_future=True, allow_empty=True, )
def calendar_view(self, request, field, year=None, month=None, day=None): easy_model = EasyModel(self.site, self.model) extra_context = { 'root_url': self.site.root_url, 'model': easy_model, 'field': field } if day is not None: # TODO: The objects in this template should be EasyInstances return date_based.archive_day( request, year, month, day, self.model.objects.all(), field.name, template_name='databrowse/calendar_day.html', allow_empty=False, allow_future=True, extra_context=extra_context) elif month is not None: return date_based.archive_month( request, year, month, self.model.objects.all(), field.name, template_name='databrowse/calendar_month.html', allow_empty=False, allow_future=True, extra_context=extra_context) elif year is not None: return date_based.archive_year( request, year, self.model.objects.all(), field.name, template_name='databrowse/calendar_year.html', allow_empty=False, allow_future=True, extra_context=extra_context) else: return date_based.archive_index( request, self.model.objects.all(), field.name, template_name='databrowse/calendar_main.html', allow_empty=True, allow_future=True, extra_context=extra_context) assert False, ('%s, %s, %s, %s' % (field, year, month, day))
def calendar_view(self, request, field, year=None, month=None, day=None): easy_model = EasyModel(self.site, self.model) queryset = easy_model.get_query_set() extra_context = { 'root_url': self.site.root_url, 'model': easy_model, 'field': field } if day is not None: return date_based.archive_day( request, year, month, day, queryset, field.name, template_name='databrowse/calendar_day.html', allow_empty=False, allow_future=True, extra_context=extra_context) elif month is not None: return date_based.archive_month( request, year, month, queryset, field.name, template_name='databrowse/calendar_month.html', allow_empty=False, allow_future=True, extra_context=extra_context) elif year is not None: return date_based.archive_year( request, year, queryset, field.name, template_name='databrowse/calendar_year.html', allow_empty=False, allow_future=True, extra_context=extra_context) else: return date_based.archive_index( request, queryset, field.name, template_name='databrowse/calendar_main.html', allow_empty=True, allow_future=True, extra_context=extra_context) assert False, ('%s, %s, %s, %s' % (field, year, month, day))
def calendar_view(self, request, field, year=None, month=None, day=None): easy_model = EasyModel(self.site, self.model) queryset = easy_model.get_query_set() extra_context = {"root_url": self.site.root_url, "model": easy_model, "field": field} if day is not None: return date_based.archive_day( request, year, month, day, queryset, field.name, template_name="databrowse/calendar_day.html", allow_empty=False, allow_future=True, extra_context=extra_context, ) elif month is not None: return date_based.archive_month( request, year, month, queryset, field.name, template_name="databrowse/calendar_month.html", allow_empty=False, allow_future=True, extra_context=extra_context, ) elif year is not None: return date_based.archive_year( request, year, queryset, field.name, template_name="databrowse/calendar_year.html", allow_empty=False, allow_future=True, extra_context=extra_context, ) else: return date_based.archive_index( request, queryset, field.name, template_name="databrowse/calendar_main.html", allow_empty=True, allow_future=True, extra_context=extra_context, ) assert False, "%s, %s, %s, %s" % (field, year, month, day)
def archive_day(self, request, *args, **kwargs): #TODO: Enable pagination when Django's ticket #2367 is fixed. if 'entry_queryset' in kwargs: queryset = kwargs['entry_queryset'] del kwargs['entry_queryset'] else: queryset = self.entry_queryset info_dict = { 'queryset': queryset, 'date_field': self.publication_date_field, 'template_name': '%s/entry_archive_day.html' % self.template_root_path, 'template_object_name': 'entry', } return date_based.archive_day(request, *args, **dict(info_dict, month_format=self.month_format, **kwargs))
def blog_date(request, blog_slug=None, year=None, month=None, day=None): """ Shows all of a blog's entries for a given day, month or year using the appropriate generic view. """ blog = Blog.objects.get(slug=blog_slug) entries = Entry.get_published.filter(blog=blog) if day: date_string = format(date(int(year), int(month), int(day)), "N j, Y") archive_name = "Posts to %s on %s" % (blog, date_string) return archive_day(request, year, month, day, entries, 'pub_date', month_format='%m', extra_context={ 'blog': blog, 'archive_name': archive_name }, allow_empty=True, template_name='blogs/entry_archive.html') elif month: date_string = format(date(int(year), int(month), 1), "F Y") archive_name = "Posts to %s in %s" % (blog, date_string) return archive_month(request, year, month, entries, 'pub_date', month_format='%m', extra_context={ 'blog': blog, 'archive_name': archive_name }, allow_empty=True, template_name='blogs/entry_archive.html') elif year: archive_name = "Months in %s with posts to %s" % (year, blog) return archive_year(request, year, entries, 'pub_date', extra_context={ 'blog': blog, 'archive_name': archive_name }, allow_empty=True, template_name='blogs/entry_archive.html')
def post_archive_day(request, year, month, day, edition=None, category=None, code=None, project_slug=None, **kwargs): if project_slug: project = get_object_or_404(Project, slug=project_slug) else: project = get_object_or_404(Project, edition=edition, category=category, code=code) return date_based.archive_day( request, year=year, month=month, day=day, date_field="publish", queryset=Post.objects.published(project), **kwargs )
def archive_day(request, year=None, month=None, day=None): """A view of posts published on a given day""" return date_based.archive_day(request, queryset=BlogEntry.objects.published(), template_name="blogging/blog_archive_list.html", date_field='pub_date', year=year, month=month, month_format="%m", day=day, extra_context={ 'archive_type': 'day', 'date': date(int(year), int(month), int(day))}, template_object_name='entry' )
def show_resources_by_day(request, community, year, month, day): """ Returns to the index where you will see only the elements of the corresponding ``year``, ``month``, ``day`` **Arguments:** * ``request`` * ``community``: community to watch * ``year`` * ``month`` * ``day`` **Template:** ``community/resource_archive_day.html`` **Context-variables:** * community: the community object **Returns:** <archive_day `django.views.generic.date_based.archive_day`> view. **Raise:** :class:`django.http.Http404` if no :class:`Community <community.models.Community>` object exist. """ import time, datetime date_stamp = time.strptime(year+month+day, "%Y%m%d") pubdate = datetime.date(*date_stamp[:3]) c = get_object_or_404(Community, slug=community) # query = c.resource_set.select_related(depth=2).filter(pub_date__year=pubdate.year) # query = query.filter(pub_date__month=pubdate.month).filter(pub_date__day=pubdate.day) query = Community.objects.live_resources(c).select_related(depth=2) query = query.filter(pub_date__year=pubdate.year, pub_date__month=pubdate.month, pub_date__day=pubdate.day) return archive_day(request, year=year, month=month, day=day, queryset = query.order_by('-pub_date'), date_field='pub_date', month_format='%m', day_format='%d', template_name='community/resource_archive_day.html', extra_context={'community':community,})
def post_archive_day(request, year, month, day): """ Post archive day Templates: ``nebula/post_archive_day.html`` Context: object_list: list of objects published that day day: (datetime) the day previous_day (datetime) the previous day next_day (datetime) the next day, or None if the current day is today """ return date_based.archive_day( request, year=year, month=month, day=day, date_field="posted", queryset=AggregatedPost.objects.active() )
def blog_date(request, blog_slug=None, year=None, month=None, day=None): """ Shows all of a blog's entries for a given day, month or year using the appropriate generic view. """ blog = Blog.objects.get(slug=blog_slug) entries = Entry.get_published.filter(blog=blog) if day: date_string = format(date(int(year), int(month), int(day)), "N j, Y") archive_name = "Posts to %s on %s" % (blog, date_string) return archive_day(request, year, month, day, entries, 'pub_date', month_format='%m', extra_context={'blog': blog, 'archive_name': archive_name}, allow_empty=True, template_name='blogs/entry_archive.html') elif month: date_string = format(date(int(year), int(month), 1), "F Y") archive_name = "Posts to %s in %s" % (blog, date_string) return archive_month(request, year, month, entries, 'pub_date', month_format='%m', extra_context={'blog': blog, 'archive_name': archive_name}, allow_empty=True, template_name='blogs/entry_archive.html') elif year: archive_name = "Months in %s with posts to %s" % (year, blog) return archive_year(request, year, entries, 'pub_date', extra_context={'blog': blog, 'archive_name': archive_name}, allow_empty=True, template_name='blogs/entry_archive.html')
def post_archive_day(request, year, month, day, template_name='nadb/post_archive_day.html', extra_context=None, **kwargs): """ Display a list of published blog posts in a given day. **Template:** nadb/post_archive_day.html or ``template_name`` keyword argument. **Template context:** In addition to extra_context, the template's context will be: ``day`` A datetime.date object representing the given day. ``next_day`` A datetime.date object representing the next day. If the next day is in the future, this will be None. ``previous_day`` A datetime.date object representing the previous day. Unlike next_day, this will never be None. ``object_list`` A list of objects available for the given day. """ return date_based.archive_day( request, year=year, month=month, day=day, date_field='published', queryset=Post.objects.published(), template_name=template_name, extra_context=extra_context, **kwargs )
def post_archive_day(request, year, month, day): """ Post archive day Templates: ``nebula/post_archive_day.html`` Context: object_list: list of objects published that day day: (datetime) the day previous_day (datetime) the previous day next_day (datetime) the next day, or None if the current day is today """ return date_based.archive_day( request, year = year, month = month, day = day, date_field = 'posted', queryset = AggregatedPost.objects.active(), )
def event_day(request, year=None, month=None, day=None, **kwargs): """Displays the list of calendar for the given day. """ current_day = _current_day(year, month, day) previous_day = current_day - datetime.timedelta(1) next_day = current_day + datetime.timedelta(1) return archive_day(request, year=year, month=month, day=day, queryset=Event.objects.for_user(request.user), date_field="start", month_format="%m", allow_empty=True, allow_future=True, template_name="calendar/event_day.html", extra_context={ 'previous_day': previous_day, 'next_day': next_day, 'current_day': current_day }, **kwargs)
def friends_archive_day(request, year, month, day): """ Post archive day Templates: ``friends/index.html`` Context: object_list: list of objects published that day day: (datetime) the day previous_day (datetime) the previous day next_day (datetime) the next day, or None if the current day is today """ return date_based.archive_day(request, year=year, month=month, month_format='%m', day=day, date_field='posted', queryset=FriendPost.objects.active(), template_name='friends/index.html')
def article_list_day(request, *args, **kwargs): from django.views.generic.date_based import archive_day return archive_day(request, *args, **kwargs)
def blog_archive_day(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() return archive_day(request, **kwargs)
def archive_day(request, *args, **kwargs): return date_based.archive_day(request, *args, **kwargs)
def blog_archive_day(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() set_language_changer(request, language_changer) return archive_day(request, **kwargs)