implement get_context_data for UserDashboardView
- expose user's hosting packages in UserDashboardView.get_context_data
This commit is contained in:
parent
0e32aff544
commit
d34f3596ae
1 changed files with 10 additions and 0 deletions
|
@ -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'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue