'Get a queryset properly filtered according to `allow_future` and any
extra lookup kwargs.'

def get_dated_queryset(self, **lookup):

    qs = self.get_queryset().filter(**lookup)
    date_field = self.get_date_field()
    allow_future = self.get_allow_future()
    allow_empty = self.get_allow_empty()
    if (not allow_future):
        qs = qs.filter(**{('%s__lte' % date_field): datetime.datetime.now()})
    if ((not allow_empty) and (not qs)):
        raise Http404((_(u'No    %(verbose_name_plural)s    available') % {'verbose_name_plural': force_unicode(qs.model._meta.verbose_name_plural)}))
    return qs
