Improve hosting package and account list workflows
This commit is contained in:
1 parent
d6fc3b8455
commit
b1be8bfb29
15 files changed
+228
-11
No files matched your search
@@ -91,6 +91,9 @@ heading, help, fields, and actions should share a left edge.
|
|||||||
for row-level actions such as **Import mail**, **Change password**, and
|
for row-level actions such as **Import mail**, **Change password**, and
|
||||||
**Manage logins**. Use `.button danger compact` for opening a removal
|
**Manage logins**. Use `.button danger compact` for opening a removal
|
||||||
workflow. Keep the final destructive confirmation visually distinct.
|
workflow. Keep the final destructive confirmation visually distinct.
|
||||||
|
- Keep a record name and its secondary identifier in one table cell. Use a
|
||||||
|
wrapping row when space permits, and omit the identifier when it repeats
|
||||||
|
the name. The record name remains the link.
|
||||||
- Group table actions in a wrapping `.table-actions` container. Center
|
- Group table actions in a wrapping `.table-actions` container. Center
|
||||||
them vertically within the row and allow labels to wrap instead of
|
them vertically within the row and allow labels to wrap instead of
|
||||||
widening the whole table. Keep overflow within `.table-scroll`.
|
widening the whole table. Keep overflow within `.table-scroll`.
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ from .models import (
|
|||||||
HostingPlan,
|
HostingPlan,
|
||||||
Reseller,
|
Reseller,
|
||||||
)
|
)
|
||||||
|
from .package_order import by_storage_quota
|
||||||
from .reseller_accounts import (
|
from .reseller_accounts import (
|
||||||
create_reseller_account,
|
create_reseller_account,
|
||||||
lock_resellers,
|
lock_resellers,
|
||||||
@@ -312,7 +313,7 @@ class ManagerPackagesView(UserPassesTestMixin, ListView):
|
|||||||
return self.manager is not None
|
return self.manager is not None
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return self.manager.hosting_plans.order_by("name")
|
return by_storage_quota(self.manager.hosting_plans.all())
|
||||||
|
|
||||||
|
|
||||||
class AllUsersView(OperatorOnlyMixin, PermissionRequiredMixin, ListView):
|
class AllUsersView(OperatorOnlyMixin, PermissionRequiredMixin, ListView):
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from django.db.models import F
|
||||||
|
|
||||||
|
|
||||||
|
def by_storage_quota(queryset):
|
||||||
|
"""Sort packages by website storage first."""
|
||||||
|
quotas = (
|
||||||
|
"website_storage_limit_mib",
|
||||||
|
"mailbox_quota_mib",
|
||||||
|
"website_limit",
|
||||||
|
"mailbox_limit",
|
||||||
|
"database_limit",
|
||||||
|
"website_job_limit",
|
||||||
|
)
|
||||||
|
return queryset.order_by(
|
||||||
|
*(F(field).asc(nulls_last=True) for field in quotas), "name", "pk"
|
||||||
|
)
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||||
from django.db import IntegrityError, transaction
|
from django.db import IntegrityError, transaction
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
|
from django.utils.functional import cached_property
|
||||||
from django.views.generic import CreateView, ListView, UpdateView
|
from django.views.generic import CreateView, ListView, UpdateView
|
||||||
|
|
||||||
from .access import OperatorOnlyMixin
|
from .access import OperatorOnlyMixin
|
||||||
@@ -31,7 +33,7 @@ class ResellerProfileForm(forms.ModelForm):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
add_unlimited_fields(self, ("account_limit",))
|
add_unlimited_fields(self, ("account_limit",))
|
||||||
if not self.instance.pk:
|
if not self.instance.pk:
|
||||||
self.initial["account_limit"] = 0
|
self.initial.setdefault("account_limit", 0)
|
||||||
self.initial["use_as_default"] = self.instance.default_slot == 1
|
self.initial["use_as_default"] = self.instance.default_slot == 1
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
@@ -87,5 +89,25 @@ class ResellerProfileCreate(ProfileEditor, CreateView):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ResellerProfileDuplicate(ResellerProfileCreate):
|
||||||
|
extra_context = {"page_title": "Duplicate manager package"}
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def source(self):
|
||||||
|
return get_object_or_404(ResellerProfile, pk=self.kwargs["pk"])
|
||||||
|
|
||||||
|
def get_initial(self):
|
||||||
|
return {
|
||||||
|
"account_limit": self.source.account_limit,
|
||||||
|
"hosting_plans": list(
|
||||||
|
self.source.hosting_plans.values_list("pk", flat=True)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
form.instance.manage_resources = self.source.manage_resources
|
||||||
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
class ResellerProfileEdit(ProfileEditor, UpdateView):
|
class ResellerProfileEdit(ProfileEditor, UpdateView):
|
||||||
pass
|
pass
|
||||||
@@ -713,8 +713,16 @@ h3, h4, h5, h6 {
|
|||||||
flex: 1 1 25rem;
|
flex: 1 1 25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.account-domain {
|
.account-identity {
|
||||||
margin-top: 0.22rem;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.15rem 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-identity > * {
|
||||||
|
min-width: 0;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
.account-heading-meta {
|
.account-heading-meta {
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<div class="account-identity">
|
||||||
|
<a class="record-link" href="{{ account_url }}">{{ name }}</a>
|
||||||
|
{% if primary_domain|lower != name|lower %}<span class="domain muted">{{ primary_domain }}</span>{% endif %}
|
||||||
|
</div>
|
||||||
@@ -53,8 +53,7 @@
|
|||||||
{% for account in accounts %}
|
{% for account in accounts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a class="record-link" href="{{ account.get_absolute_url }}">{{ account.name }}</a>
|
{% include "hosting/account_identity.html" with account_url=account.get_absolute_url name=account.name primary_domain=account.primary_domain only %}
|
||||||
<div class="domain muted account-domain">{{ account.primary_domain }}</div>
|
|
||||||
{% if is_customer %}
|
{% if is_customer %}
|
||||||
<div class="table-actions">
|
<div class="table-actions">
|
||||||
{% if show_customer_website_link %}<a href="{{ account.get_absolute_url }}#websites">Websites</a>{% endif %}
|
{% if show_customer_website_link %}<a href="{{ account.get_absolute_url }}#websites">Websites</a>{% endif %}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for account in page.accounts %}
|
{% for account in page.accounts %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><a class="record-link" href="{{ account.url }}">{{ account.name }}</a><div class="domain muted account-domain">{{ account.primary_domain }}</div></th>
|
<th scope="row">{% include "hosting/account_identity.html" with account_url=account.url name=account.name primary_domain=account.primary_domain only %}</th>
|
||||||
<td>{% include "hosting/hosting_node.html" with node=page.node only %}</td>
|
<td>{% include "hosting/hosting_node.html" with node=page.node only %}</td>
|
||||||
<td>{% include "hosting/account_status.html" %}</td>
|
<td>{% include "hosting/account_status.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
<th scope="col">Default website limit</th>
|
<th scope="col">Default website limit</th>
|
||||||
<th scope="col">Scheduled jobs</th>
|
<th scope="col">Scheduled jobs</th>
|
||||||
<th scope="col">PHP overrides</th>
|
<th scope="col">PHP overrides</th>
|
||||||
|
{% if perms.hosting.add_hostingplan %}<th scope="col">Actions</th>{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -44,6 +45,9 @@
|
|||||||
<td>{% if hosting_plan.website_storage_limit_mib is not None %}{{ hosting_plan.website_storage_limit_mib }} MiB{% else %}Unlimited{% endif %}</td>
|
<td>{% if hosting_plan.website_storage_limit_mib is not None %}{{ hosting_plan.website_storage_limit_mib }} MiB{% else %}Unlimited{% endif %}</td>
|
||||||
<td>{{ hosting_plan.website_job_limit|default_if_none:"Unlimited" }}</td>
|
<td>{{ hosting_plan.website_job_limit|default_if_none:"Unlimited" }}</td>
|
||||||
<td>{% if hosting_plan.get_php_settings.has_overrides %}Configured{% else %}Server defaults{% endif %}</td>
|
<td>{% if hosting_plan.get_php_settings.has_overrides %}Configured{% else %}Server defaults{% endif %}</td>
|
||||||
|
{% if perms.hosting.add_hostingplan %}
|
||||||
|
<td><div class="table-actions"><a class="button secondary compact" href="{% url 'panel:hosting_plan_duplicate' hosting_plan.pk %}" aria-label="Duplicate {{ hosting_plan.name }}">Duplicate</a></div></td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends "hosting/workspace_page.html" %}
|
{% extends "hosting/workspace_page.html" %}
|
||||||
{% load panel_assets %}
|
{% load panel_assets %}
|
||||||
{% block title %}{% if object %}Edit manager package{% else %}Add manager package{% endif %} · Coulobre Panel{% endblock %}
|
{% block title %}{% if page_title %}{{ page_title }}{% elif object %}Edit manager package{% else %}Add manager package{% endif %} · Coulobre Panel{% endblock %}
|
||||||
{% block page_title %}{% if object %}Edit manager package{% else %}Add manager package{% endif %}{% endblock %}
|
{% block page_title %}{% if page_title %}{{ page_title }}{% elif object %}Edit manager package{% else %}Add manager package{% endif %}{% endblock %}
|
||||||
{% block page_context %}
|
{% block page_context %}
|
||||||
<a class="quiet-link" href="{% url 'panel:reseller_profiles' %}">← Manager packages</a>
|
<a class="quiet-link" href="{% url 'panel:reseller_profiles' %}">← Manager packages</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -13,15 +13,16 @@
|
|||||||
<section class="surface">
|
<section class="surface">
|
||||||
<div class="table-scroll">
|
<div class="table-scroll">
|
||||||
<table>
|
<table>
|
||||||
<thead><tr><th scope="col">Package</th><th scope="col">Account limit</th></tr></thead>
|
<thead><tr><th scope="col">Package</th><th scope="col">Account limit</th><th scope="col">Actions</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for profile in object_list %}
|
{% for profile in object_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'panel:reseller_profile_edit' profile.pk %}">{{ profile.name }}</a>{% if profile.default_slot %} · Default{% endif %}</td>
|
<td><a href="{% url 'panel:reseller_profile_edit' profile.pk %}">{{ profile.name }}</a>{% if profile.default_slot %} · Default{% endif %}</td>
|
||||||
<td>{% if profile.account_limit == 0 %}Manage existing accounts only{% else %}{{ profile.account_limit|default_if_none:"Unlimited" }}{% endif %}</td>
|
<td>{% if profile.account_limit == 0 %}Manage existing accounts only{% else %}{{ profile.account_limit|default_if_none:"Unlimited" }}{% endif %}</td>
|
||||||
|
<td><div class="table-actions"><a class="button secondary compact" href="{% url 'panel:reseller_profile_duplicate' profile.pk %}" aria-label="Duplicate {{ profile.name }}">Duplicate</a></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<tr><td colspan="2">No manager packages yet. Add one to reuse account limits and a set of hosting packages.</td></tr>
|
<tr><td colspan="3">No manager packages yet. Add one to reuse account limits and a set of hosting packages.</td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from .models import HostingAccount, HostingPlan, Reseller, ResellerProfile
|
||||||
|
|
||||||
|
|
||||||
|
class PackageWorkflowTests(TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpTestData(cls):
|
||||||
|
users = get_user_model().objects
|
||||||
|
cls.operator = users.create_superuser("operator")
|
||||||
|
cls.manager = Reseller.objects.create(
|
||||||
|
user=users.create_user("manager")
|
||||||
|
)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.client.force_login(self.operator)
|
||||||
|
|
||||||
|
def test_package_order_is_numeric_and_scoped(self):
|
||||||
|
plans = [
|
||||||
|
HostingPlan.objects.create(
|
||||||
|
name=name,
|
||||||
|
website_storage_limit_mib=storage,
|
||||||
|
mailbox_limit=mail,
|
||||||
|
)
|
||||||
|
for name, storage, mail in (
|
||||||
|
("Unlimited", None, 1),
|
||||||
|
("10 GiB", 10240, 1),
|
||||||
|
("5 GiB", 5120, 1),
|
||||||
|
("1 GiB high mail", 1024, 9),
|
||||||
|
("1 GiB low mail", 1024, 2),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
self.manager.hosting_plans.add(*plans[:4])
|
||||||
|
response = self.client.get(reverse("panel:hosting_plans"))
|
||||||
|
self.assertEqual(list(response.context["hosting_plans"]), plans[::-1])
|
||||||
|
self.client.force_login(self.manager.user)
|
||||||
|
response = self.client.get(reverse("panel:manager_packages"))
|
||||||
|
self.assertEqual(list(response.context["plans"]), plans[3::-1])
|
||||||
|
|
||||||
|
def test_hosting_package_copy_is_prefilled_and_independent(self):
|
||||||
|
plan = HostingPlan.objects.create(
|
||||||
|
name="Source",
|
||||||
|
description="Package description",
|
||||||
|
website_limit=None,
|
||||||
|
website_storage_limit_mib=1024,
|
||||||
|
website_job_limit=0,
|
||||||
|
allow_external_mail_forwarding=True,
|
||||||
|
php_memory_limit_mib=0,
|
||||||
|
)
|
||||||
|
account = HostingAccount.objects.create(
|
||||||
|
name="Example", primary_domain="example.org", hosting_plan=plan
|
||||||
|
)
|
||||||
|
url = reverse("panel:hosting_plan_duplicate", args=[plan.pk])
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(reverse("panel:hosting_plans")), url
|
||||||
|
)
|
||||||
|
form = self.client.get(url).context["form"]
|
||||||
|
self.assertEqual(form["description"].value(), plan.description)
|
||||||
|
self.assertIsNone(form["website_limit"].value())
|
||||||
|
self.assertEqual(form["php_memory_limit_mib"].value(), 0)
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(
|
||||||
|
url,
|
||||||
|
{
|
||||||
|
"name": "Copy",
|
||||||
|
"description": plan.description,
|
||||||
|
"website_limit_unlimited": "on",
|
||||||
|
"website_job_limit": "0",
|
||||||
|
"website_storage_limit_mib": "1024",
|
||||||
|
"allow_external_mail_forwarding": "on",
|
||||||
|
"php_memory_limit_mib_unlimited": "on",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
reverse("panel:hosting_plans"),
|
||||||
|
)
|
||||||
|
copy = HostingPlan.objects.get(name="Copy")
|
||||||
|
self.assertTrue(copy.allow_external_mail_forwarding)
|
||||||
|
self.assertIsNone(copy.website_limit)
|
||||||
|
self.assertEqual(copy.php_memory_limit_mib, 0)
|
||||||
|
account.refresh_from_db()
|
||||||
|
self.assertEqual(account.hosting_plan, plan)
|
||||||
|
self.client.force_login(self.manager.user)
|
||||||
|
self.assertEqual(self.client.get(url).status_code, 403)
|
||||||
|
|
||||||
|
def test_manager_package_copy_keeps_policy_without_default(self):
|
||||||
|
plan = HostingPlan.objects.create(name="Allowed")
|
||||||
|
source = ResellerProfile.objects.create(
|
||||||
|
name="Source", manage_resources=True, default_slot=1
|
||||||
|
)
|
||||||
|
source.hosting_plans.add(plan)
|
||||||
|
url = reverse("panel:reseller_profile_duplicate", args=[source.pk])
|
||||||
|
form = self.client.get(url).context["form"]
|
||||||
|
self.assertIsNone(form["account_limit"].value())
|
||||||
|
self.assertFalse(form["use_as_default"].value())
|
||||||
|
self.assertEqual(form["hosting_plans"].value(), [plan.pk])
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(
|
||||||
|
url,
|
||||||
|
{
|
||||||
|
"name": "Copy",
|
||||||
|
"account_limit_unlimited": "on",
|
||||||
|
"hosting_plans": [plan.pk],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
reverse("panel:reseller_profiles"),
|
||||||
|
)
|
||||||
|
copy = ResellerProfile.objects.get(name="Copy")
|
||||||
|
self.assertTrue(copy.manage_resources)
|
||||||
|
self.assertIsNone(copy.default_slot)
|
||||||
|
self.assertIsNone(copy.account_limit)
|
||||||
|
self.assertEqual(list(copy.hosting_plans.all()), [plan])
|
||||||
|
source.refresh_from_db()
|
||||||
|
self.assertEqual(source.default_slot, 1)
|
||||||
|
|
||||||
|
def test_account_domain_is_not_repeated_when_it_matches_the_name(self):
|
||||||
|
HostingAccount.objects.create(
|
||||||
|
name="Same.example", primary_domain="same.example"
|
||||||
|
)
|
||||||
|
HostingAccount.objects.create(
|
||||||
|
name="Different", primary_domain="different.example"
|
||||||
|
)
|
||||||
|
response = self.client.get(reverse("panel:accounts"))
|
||||||
|
self.assertContains(response, 'class="account-identity"', count=2)
|
||||||
|
self.assertNotContains(response, ">same.example</span>")
|
||||||
|
self.assertContains(response, ">different.example</span>")
|
||||||
@@ -97,6 +97,7 @@ from .reseller_onboarding_views import (
|
|||||||
)
|
)
|
||||||
from .reseller_profiles import (
|
from .reseller_profiles import (
|
||||||
ResellerProfileCreate,
|
ResellerProfileCreate,
|
||||||
|
ResellerProfileDuplicate,
|
||||||
ResellerProfileEdit,
|
ResellerProfileEdit,
|
||||||
ResellerProfileList,
|
ResellerProfileList,
|
||||||
)
|
)
|
||||||
@@ -645,6 +646,11 @@ urlpatterns = [
|
|||||||
ResellerProfileEdit.as_view(),
|
ResellerProfileEdit.as_view(),
|
||||||
name="reseller_profile_edit",
|
name="reseller_profile_edit",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"resellers/profiles/<int:pk>/duplicate/",
|
||||||
|
ResellerProfileDuplicate.as_view(),
|
||||||
|
name="reseller_profile_duplicate",
|
||||||
|
),
|
||||||
path("resellers/new/", ResellerCreate.as_view(), name="reseller_create"),
|
path("resellers/new/", ResellerCreate.as_view(), name="reseller_create"),
|
||||||
path("resellers/<int:pk>/", ResellerDetail.as_view(), name="reseller"),
|
path("resellers/<int:pk>/", ResellerDetail.as_view(), name="reseller"),
|
||||||
path(
|
path(
|
||||||
@@ -818,6 +824,11 @@ urlpatterns = [
|
|||||||
views.HostingPlanEdit.as_view(),
|
views.HostingPlanEdit.as_view(),
|
||||||
name="hosting_plan_edit",
|
name="hosting_plan_edit",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"hosting-plans/<int:pk>/duplicate/",
|
||||||
|
views.HostingPlanDuplicate.as_view(),
|
||||||
|
name="hosting_plan_duplicate",
|
||||||
|
),
|
||||||
path("plans/", views.PlanList.as_view(), name="plans"),
|
path("plans/", views.PlanList.as_view(), name="plans"),
|
||||||
path("plans/<int:pk>/", views.PlanDetail.as_view(), name="plan"),
|
path("plans/<int:pk>/", views.PlanDetail.as_view(), name="plan"),
|
||||||
path(
|
path(
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ from .models import (
|
|||||||
)
|
)
|
||||||
from .offsite_backups import queue_offsite_recovery, retry_offsite_transfer
|
from .offsite_backups import queue_offsite_recovery, retry_offsite_transfer
|
||||||
from .offsite_destinations import offsite_destinations
|
from .offsite_destinations import offsite_destinations
|
||||||
|
from .package_order import by_storage_quota
|
||||||
from .php_settings import (
|
from .php_settings import (
|
||||||
SitePhpSettingsForm,
|
SitePhpSettingsForm,
|
||||||
last_applied_php_settings,
|
last_applied_php_settings,
|
||||||
@@ -2821,6 +2822,9 @@ class HostingPlanList(OperatorOnlyMixin, PermissionRequiredMixin, ListView):
|
|||||||
context_object_name = "hosting_plans"
|
context_object_name = "hosting_plans"
|
||||||
paginate_by = 20
|
paginate_by = 20
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return by_storage_quota(super().get_queryset())
|
||||||
|
|
||||||
|
|
||||||
class HostingPlanEditor:
|
class HostingPlanEditor:
|
||||||
model = HostingPlan
|
model = HostingPlan
|
||||||
@@ -2954,6 +2958,21 @@ class HostingPlanCreate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class HostingPlanDuplicate(HostingPlanCreate):
|
||||||
|
extra_context = {
|
||||||
|
"page_title": "Duplicate hosting package",
|
||||||
|
"submit_label": "Create package copy",
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_initial(self):
|
||||||
|
source = get_object_or_404(HostingPlan, pk=self.kwargs["pk"])
|
||||||
|
return {
|
||||||
|
field: getattr(source, field)
|
||||||
|
for field in self.fields
|
||||||
|
if field != "name"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class HostingPlanEdit(
|
class HostingPlanEdit(
|
||||||
OperatorOnlyMixin, PermissionRequiredMixin, HostingPlanEditor, UpdateView
|
OperatorOnlyMixin, PermissionRequiredMixin, HostingPlanEditor, UpdateView
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -92,8 +92,10 @@ WORKSPACE_PARENT_ROUTES = {
|
|||||||
"reseller_edit": ("resellers", ()),
|
"reseller_edit": ("resellers", ()),
|
||||||
"hosting_plan_create": ("hosting_plans", ()),
|
"hosting_plan_create": ("hosting_plans", ()),
|
||||||
"hosting_plan_edit": ("hosting_plans", ()),
|
"hosting_plan_edit": ("hosting_plans", ()),
|
||||||
|
"hosting_plan_duplicate": ("hosting_plans", ()),
|
||||||
"reseller_profile_create": ("reseller_profiles", ()),
|
"reseller_profile_create": ("reseller_profiles", ()),
|
||||||
"reseller_profile_edit": ("reseller_profiles", ()),
|
"reseller_profile_edit": ("reseller_profiles", ()),
|
||||||
|
"reseller_profile_duplicate": ("reseller_profiles", ()),
|
||||||
"manager_assign_plan": ("manager_packages", ()),
|
"manager_assign_plan": ("manager_packages", ()),
|
||||||
"account": ("accounts", ()),
|
"account": ("accounts", ()),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user