implement hosting package option choice view
- implement new hostingpackages.views.HostingOptionChoices - add URL pattern 'hosting_option_choices' to hostingpackages.urls - add template hostingpackages/customerhostingpackage_option_choices.html - link from hostingpackages/customerhostingpackage_detail.html to 'hosting_package_choices'
This commit is contained in:
parent
353ea7ad90
commit
9815bd1f5b
4 changed files with 64 additions and 3 deletions
|
@ -8,9 +8,10 @@ from django.conf.urls import patterns, url
|
|||
|
||||
from .views import (
|
||||
AllCustomerHostingPackageList,
|
||||
CreateHostingPackage,
|
||||
CreateCustomerHostingPackage,
|
||||
CreateHostingPackage,
|
||||
CustomerHostingPackageDetails,
|
||||
HostingOptionChoices,
|
||||
)
|
||||
|
||||
|
||||
|
@ -27,4 +28,7 @@ urlpatterns = patterns(
|
|||
url(r'^allpackages/',
|
||||
AllCustomerHostingPackageList.as_view(),
|
||||
name='all_hosting_packages'),
|
||||
url(r'^(?P<pk>\d+)/option-choices$',
|
||||
HostingOptionChoices.as_view(),
|
||||
name='hosting_option_choices'),
|
||||
)
|
||||
|
|
|
@ -26,7 +26,12 @@ from .forms import (
|
|||
CreateCustomerHostingPackageForm,
|
||||
CreateHostingPackageForm,
|
||||
)
|
||||
from .models import CustomerHostingPackage
|
||||
from .models import (
|
||||
CustomerHostingPackage,
|
||||
DiskSpaceOption,
|
||||
MailboxOption,
|
||||
UserDatabaseOption,
|
||||
)
|
||||
|
||||
|
||||
class CreateHostingPackage(
|
||||
|
@ -111,3 +116,32 @@ class AllCustomerHostingPackageList(
|
|||
):
|
||||
model = CustomerHostingPackage
|
||||
template_name_suffix = '_admin_list'
|
||||
|
||||
|
||||
class HostingOptionChoices(
|
||||
LoginRequiredMixin, StaffuserRequiredMixin, DetailView
|
||||
):
|
||||
"""
|
||||
This view displays choices of hosting options for a customer hosting
|
||||
package.
|
||||
|
||||
"""
|
||||
model = CustomerHostingPackage
|
||||
context_object_name = 'hostingpackage'
|
||||
template_name_suffix = '_option_choices'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(HostingOptionChoices, self).get_context_data(
|
||||
**kwargs)
|
||||
context.update({
|
||||
'customer': self.get_object().customer,
|
||||
'hosting_options': (
|
||||
(_('Disk space'),
|
||||
DiskSpaceOption.objects.all()),
|
||||
(_('Mailboxes'),
|
||||
MailboxOption.objects.all()),
|
||||
(_('Databases'),
|
||||
UserDatabaseOption.objects.all())
|
||||
),
|
||||
})
|
||||
return context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue