Skip to content

Instantly share code, notes, and snippets.

@darklow
Created March 26, 2013 13:49
Show Gist options
  • Save darklow/5245501 to your computer and use it in GitHub Desktop.
Save darklow/5245501 to your computer and use it in GitHub Desktop.
# urls.py
url(r'^admin/dashboard/', staff_member_required(DashboardListView.as_view()), name='dashboard'),
# views.py
class DashboardListView(ListView):
context_object_name = 'task_list'
template_name = 'admin/dashboard.html'
def get_queryset(self):
today = date.today()
return Note.objects.filter(Q(user=self.request.user)).order_by(
'-remind_at')
def get_context_data(self, **kwargs):
context = super(DashboardListView, self).get_context_data(**kwargs)
context['title'] = 'Dashboard'
context['admin_site'] = 'Home'
return context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment