List OS user in admin hosting package list
This commit is contained in:
parent
806ee80a85
commit
a136bcc52b
3 changed files with 32 additions and 17 deletions
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gnuviechadmin hostingpackages\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-04-16 22:07+0200\n"
|
||||
"PO-Revision-Date: 2023-04-16 19:10+0200\n"
|
||||
"POT-Creation-Date: 2023-04-22 13:14+0200\n"
|
||||
"PO-Revision-Date: 2023-04-22 13:15+0200\n"
|
||||
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
|
||||
"Language-Team: Jan Dittberner <jan@dittberner.info>\n"
|
||||
"Language: de\n"
|
||||
|
@ -233,15 +233,19 @@ msgid "Customer"
|
|||
msgstr "Kunde"
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html:13
|
||||
msgid "OS User"
|
||||
msgstr "OS-Nutzer"
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html:14
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_list.html:27
|
||||
msgid "Setup date"
|
||||
msgstr "Einrichtungsdatum"
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html:29
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html:31
|
||||
msgid "No hosting packages have been setup yet."
|
||||
msgstr "Es wurden noch keine Hostingpakete eingerichtet."
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html:32
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html:34
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_list.html:46
|
||||
msgid "Add hosting package"
|
||||
msgstr "Hostingpaket anlegen"
|
||||
|
@ -284,7 +288,7 @@ msgid "Description"
|
|||
msgstr "Beschreibung"
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_detail.html:40
|
||||
#: hostingpackages/views.py:190
|
||||
#: hostingpackages/views.py:199
|
||||
msgid "Disk space"
|
||||
msgstr "Speicherplatz"
|
||||
|
||||
|
@ -305,7 +309,7 @@ msgstr ""
|
|||
"der Unterschied ergibt sich aus Speicherplatzoptionen"
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_detail.html:52
|
||||
#: hostingpackages/views.py:197
|
||||
#: hostingpackages/views.py:206
|
||||
msgid "Mailboxes"
|
||||
msgstr "Postfächer"
|
||||
|
||||
|
@ -487,7 +491,7 @@ msgid "Add mailbox"
|
|||
msgstr "Postfach hinzufügen"
|
||||
|
||||
#: hostingpackages/templates/hostingpackages/customerhostingpackage_detail.html:237
|
||||
#: hostingpackages/views.py:204
|
||||
#: hostingpackages/views.py:213
|
||||
msgid "Databases"
|
||||
msgstr "Datenbanken"
|
||||
|
||||
|
@ -566,7 +570,7 @@ msgstr ""
|
|||
msgid "Started setup of new hosting package {name}."
|
||||
msgstr "Einrichtung des Hostingpakets {name} wurde gestartet."
|
||||
|
||||
#: hostingpackages/views.py:278
|
||||
#: hostingpackages/views.py:287
|
||||
#, python-brace-format
|
||||
msgid "Successfully added option {option} to hosting package {package}."
|
||||
msgstr "Option {option} erfolgreich zum Hostingpaket {package} hinzugefügt."
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<tr>
|
||||
<th>{% translate "Name" %}</th>
|
||||
<th>{% translate "Customer" %}</th>
|
||||
<th>{% translate "OS User" %}</th>
|
||||
<th>{% translate "Setup date" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -20,6 +21,7 @@
|
|||
<td>
|
||||
<a href="{% url 'customer_dashboard' slug=package.customer.username %}">{{ package.customer }}</a>
|
||||
</td>
|
||||
<td>{{ package.osuser.username }}</td>
|
||||
<td>{{ package.created }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -38,19 +38,19 @@ class CreateHostingPackage(PermissionRequiredMixin, CreateView):
|
|||
|
||||
model = CustomerHostingPackage
|
||||
raise_exception = True
|
||||
permission_required = 'domains.add_customerhostingpackage'
|
||||
permission_required = "domains.add_customerhostingpackage"
|
||||
template_name_suffix = "_create"
|
||||
form_class = CreateHostingPackageForm
|
||||
|
||||
def form_valid(self, form):
|
||||
hostingpackage = form.save()
|
||||
hosting_package = form.save()
|
||||
messages.success(
|
||||
self.request,
|
||||
_("Started setup of new hosting package {name}.").format(
|
||||
name=hostingpackage.name
|
||||
name=hosting_package.name
|
||||
),
|
||||
)
|
||||
return redirect(hostingpackage)
|
||||
return redirect(hosting_package)
|
||||
|
||||
|
||||
class CreateCustomerHostingPackage(CreateHostingPackage):
|
||||
|
@ -75,16 +75,16 @@ class CreateCustomerHostingPackage(CreateHostingPackage):
|
|||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
hostingpackage = form.save(commit=False)
|
||||
hostingpackage.customer = self.get_customer_object()
|
||||
hostingpackage.save()
|
||||
hosting_package = form.save(commit=False)
|
||||
hosting_package.customer = self.get_customer_object()
|
||||
hosting_package.save()
|
||||
messages.success(
|
||||
self.request,
|
||||
_("Started setup of new hosting package {name}.").format(
|
||||
name=hostingpackage.name
|
||||
name=hosting_package.name
|
||||
),
|
||||
)
|
||||
return redirect(hostingpackage)
|
||||
return redirect(hosting_package)
|
||||
|
||||
|
||||
class CustomerHostingPackageDetails(StaffOrSelfLoginRequiredMixin, DetailView):
|
||||
|
@ -126,6 +126,7 @@ class StaffUserRequiredMixin(UserPassesTestMixin):
|
|||
Mixin to make views available to staff members only.
|
||||
|
||||
"""
|
||||
|
||||
def test_func(self):
|
||||
return self.request.user.is_staff
|
||||
|
||||
|
@ -139,6 +140,14 @@ class AllCustomerHostingPackageList(StaffUserRequiredMixin, ListView):
|
|||
model = CustomerHostingPackage
|
||||
template_name_suffix = "_admin_list"
|
||||
|
||||
def get_queryset(self):
|
||||
return (
|
||||
super()
|
||||
.get_queryset()
|
||||
.select_related("osuser", "customer")
|
||||
.only("name", "pk", "created", "customer__username", "osuser__username")
|
||||
)
|
||||
|
||||
|
||||
class CustomerHostingPackageList(StaffOrSelfLoginRequiredMixin, ListView):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue