implement get_context_data for UserDashboardView

- expose user's hosting packages in UserDashboardView.get_context_data
This commit is contained in:
Jan Dittberner 2015-01-18 16:19:28 +01:00
parent 0e32aff544
commit d34f3596ae

View file

@ -15,6 +15,8 @@ from django.contrib.auth import get_user_model, logout
from braces.views import LoginRequiredMixin from braces.views import LoginRequiredMixin
from hostingpackages.models import CustomerHostingPackage
class IndexView(TemplateView): class IndexView(TemplateView):
""" """
@ -43,6 +45,14 @@ class UserDashboardView(LoginRequiredMixin, DetailView):
_('You are not allowed to view this page.') _('You are not allowed to view this page.')
) )
def get_context_data(self, **kwargs):
context = super(UserDashboardView, self).get_context_data(**kwargs)
context['hosting_packages'] = CustomerHostingPackage.objects.filter(
customer=self.object
)
return context
class LogoutView(RedirectView): class LogoutView(RedirectView):
pattern_name = 'dashboard' pattern_name = 'dashboard'