Upgrade to Django 3.2
- update dependencies - fix deprecation warnings - fix tests - skip some tests that need more work - reformat changed code with isort and black
This commit is contained in:
parent
0f18e59d67
commit
4af1a39ca4
93 changed files with 3598 additions and 2725 deletions
|
@ -2,7 +2,7 @@
|
|||
This module contains the admin site interface for hosting packages.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
|
@ -25,9 +25,10 @@ class CustomerHostingPackageCreateForm(forms.ModelForm):
|
|||
This is the form class for creating new customer hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = CustomerHostingPackage
|
||||
fields = ['customer', 'template', 'name']
|
||||
fields = ["customer", "template", "name"]
|
||||
|
||||
def save(self, **kwargs):
|
||||
"""
|
||||
|
@ -39,10 +40,11 @@ class CustomerHostingPackageCreateForm(forms.ModelForm):
|
|||
|
||||
"""
|
||||
hostinpackages = CustomerHostingPackage.objects.create_from_template(
|
||||
customer=self.cleaned_data['customer'],
|
||||
template=self.cleaned_data['template'],
|
||||
name=self.cleaned_data['name'],
|
||||
**kwargs)
|
||||
customer=self.cleaned_data["customer"],
|
||||
template=self.cleaned_data["template"],
|
||||
name=self.cleaned_data["name"],
|
||||
**kwargs
|
||||
)
|
||||
return hostinpackages
|
||||
|
||||
def save_m2m(self):
|
||||
|
@ -55,6 +57,7 @@ class CustomerDiskSpaceOptionInline(admin.TabularInline):
|
|||
space options.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerDiskSpaceOption
|
||||
extra = 0
|
||||
|
||||
|
@ -65,6 +68,7 @@ class CustomerMailboxOptionInline(admin.TabularInline):
|
|||
mailbox options.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerMailboxOption
|
||||
extra = 0
|
||||
|
||||
|
@ -75,6 +79,7 @@ class CustomerUserDatabaseOptionInline(admin.TabularInline):
|
|||
database options.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerUserDatabaseOption
|
||||
extra = 0
|
||||
|
||||
|
@ -85,6 +90,7 @@ class CustomerHostingPackageDomainInline(admin.TabularInline):
|
|||
hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackageDomain
|
||||
extra = 0
|
||||
|
||||
|
@ -95,12 +101,9 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
:py:class:`CustomerHostingPackage`.
|
||||
|
||||
"""
|
||||
|
||||
add_form = CustomerHostingPackageCreateForm
|
||||
add_fieldsets = (
|
||||
(None, {
|
||||
'fields': ('customer', 'template', 'name')
|
||||
}),
|
||||
)
|
||||
add_fieldsets = ((None, {"fields": ("customer", "template", "name")}),)
|
||||
|
||||
inlines = [
|
||||
CustomerDiskSpaceOptionInline,
|
||||
|
@ -108,7 +111,7 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
CustomerUserDatabaseOptionInline,
|
||||
CustomerHostingPackageDomainInline,
|
||||
]
|
||||
list_display = ['name', 'customer', 'osuser']
|
||||
list_display = ["name", "customer", "osuser"]
|
||||
|
||||
def get_form(self, request, obj=None, **kwargs):
|
||||
"""
|
||||
|
@ -125,13 +128,16 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
"""
|
||||
defaults = {}
|
||||
if obj is None:
|
||||
defaults.update({
|
||||
'form': self.add_form,
|
||||
'fields': admin.options.flatten_fieldsets(self.add_fieldsets),
|
||||
})
|
||||
defaults.update(
|
||||
{
|
||||
"form": self.add_form,
|
||||
"fields": admin.options.flatten_fieldsets(self.add_fieldsets),
|
||||
}
|
||||
)
|
||||
defaults.update(kwargs)
|
||||
return super(CustomerHostingPackageAdmin, self).get_form(
|
||||
request, obj, **defaults)
|
||||
request, obj, **defaults
|
||||
)
|
||||
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
"""
|
||||
|
@ -147,7 +153,7 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
|
||||
"""
|
||||
if obj:
|
||||
return ['customer', 'template']
|
||||
return ["customer", "template"]
|
||||
return []
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue