views.py 707 Bytes
Newer Older
fred's avatar
fred committed
1 2 3 4
import datetime

from django.core.urlresolvers import reverse
from django.views.generic.base import RedirectView
fred's avatar
fred committed
5 6 7 8 9 10 11 12 13
from django.views.generic.dates import DayArchiveView

from .models import SomaLogLine

class SomaDayArchiveView(DayArchiveView):
    queryset = SomaLogLine.objects.all()
    date_field = "play_timestamp"
    make_object_list = True
    allow_future = False
fred's avatar
fred committed
14 15 16 17 18 19 20 21 22 23
    month_format = '%m'


class RedirectTodayView(RedirectView):
    def get_redirect_url(self, *args, **kwargs):
        today = datetime.datetime.today()
        return reverse('archive_day', kwargs={
                        'year': today.year,
                        'month': today.month,
                        'day': today.day})