def month(request, year, month, queryset=None,
    template_name="jellyroll/calendar/month.html", template_loader=loader,
    extra_context=None, context_processors=None, mimetype=None):
    """
    Jellyroll'd items for a particular month.

    Works a bit like a generic view in that you can pass a bunch of optional
    keyword arguments which work just like they do in generic views. Those
    arguments are: ``template_name``, ``template_loader``, ``extra_context``,
    ``context_processors``, and ``mimetype``.
    
    You can also pass a ``queryset`` argument; see the module's docstring
    for information about how that works.

    Templates: ``jellyroll/calendar/month.html`` (default)
    Context:
        ``items``
            Items from the month, earliest first.
        ``month``
            The month (a ``datetime.date`` object).
        ``previous``
            The previous month; ``None`` if that month was before jellyrolling
            started.
        ``previous_link``
            Link to the previous month
        ``next``
            The next month; ``None`` if it's in the future.
        ``next_link``
            Link to the next month
    """
    # Make sure we've requested a valid month
    try:
        date = datetime.date(*time.strptime(year+month, '%Y%b')[:3])
    except ValueError:
        raise Http404("Invalid month string")
    try:
        first = Item.objects.order_by("timestamp")[0]
    except __HOLE__:
        raise Http404("No items; no views.")
    
    # Calculate first and last day of month, for use in a date-range lookup.
    today = datetime.date.today()
    first_day = date.replace(day=1)
    if first_day.month == 12:
        last_day = first_day.replace(year=first_day.year + 1, month=1)
    else:
        last_day = first_day.replace(month=first_day.month + 1)
    
    if first_day < first.timestamp.date().replace(day=1) or date > today:
        raise Http404("Invalid month (%s .. %s)" % (first.timestamp.date(), today))
    
    # Calculate the previous month
    previous = (first_day - datetime.timedelta(days=1)).replace(day=1)
    previous_link = urlresolvers.reverse("jellyroll.views.calendar.month", args=previous.strftime("%Y %b").lower().split())
    if previous < first.timestamp.date().replace(day=1):
        previous = None
    
    # And the next month
    next = last_day + datetime.timedelta(days=1)
    next_link = urlresolvers.reverse("jellyroll.views.calendar.month", args=next.strftime("%Y %b").lower().split())
    if next > today:
        next = None
        
    # Handle the initial queryset
    if not queryset:
        queryset = Item.objects.all()
    queryset = queryset.filter(timestamp__range=(first_day, last_day))
    if not queryset.query.order_by:
        queryset = queryset.order_by("timestamp")
    
    # Build the context
    context = RequestContext(request, {
        "items"         : queryset,
        "month"         : date,
        "previous"      : previous,
        "previous_link" : previous_link,
        "next"          : next,
        "next_link"     : next_link
    }, context_processors)
    if extra_context:
        for key, value in extra_context.items():
            if callable(value):
                context[key] = value()
            else:
                context[key] = value
    
    # Load, render, and return
    t = template_loader.get_template(template_name)
    return HttpResponse(t.render(context), mimetype=mimetype)
dataset/ETHPy150Open jacobian-archive/jellyroll/src/jellyroll/views/calendar.py/month