forked from ungleich-public/dynamicweb
fix cms dependencies
This commit is contained in:
parent
6b21b86ffe
commit
fa97ef8593
3 changed files with 22 additions and 14 deletions
|
|
@ -1,11 +1,14 @@
|
|||
from django.contrib import admin
|
||||
from cms.admin.placeholderadmin import PlaceholderAdminMixin
|
||||
#from cms.admin.placeholderadmin import PlaceholderAdminMixin
|
||||
from cms.extensions import PageExtensionAdmin
|
||||
from .cms_models import CMSIntegration, CMSFaviconExtension
|
||||
from .models import VMPricing, VMTemplate
|
||||
|
||||
|
||||
class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
|
||||
"""TODO:class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
|
||||
list_display = ('name', 'domain')"""
|
||||
|
||||
class CMSIntegrationAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'domain')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from filer.fields.file import FilerFileField
|
|||
from filer.fields.image import FilerImageField
|
||||
|
||||
from datacenterlight.models import VMPricing, VMTemplate
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
|
||||
|
||||
class CMSIntegration(models.Model):
|
||||
|
|
@ -316,17 +317,22 @@ class MultipleChoiceArrayField(ArrayField):
|
|||
vm_template_choices = []
|
||||
|
||||
if settings.OPENNEBULA_DOMAIN != 'test_domain':
|
||||
vm_template_choices = [
|
||||
(
|
||||
str(obj.opennebula_vm_template_id),
|
||||
try:
|
||||
vm_template_choices = [
|
||||
(
|
||||
obj.name + ' - ' + VMTemplate.IPV6.title()
|
||||
if obj.vm_type == VMTemplate.IPV6
|
||||
else obj.name
|
||||
),
|
||||
)
|
||||
for obj in VMTemplate.objects.all()
|
||||
]
|
||||
str(obj.opennebula_vm_template_id),
|
||||
(
|
||||
obj.name + ' - ' + VMTemplate.IPV6.title()
|
||||
if obj.vm_type == VMTemplate.IPV6
|
||||
else obj.name
|
||||
),
|
||||
)
|
||||
for obj in VMTemplate.objects.all()
|
||||
]
|
||||
except (ProgrammingError, OperationalError):
|
||||
# The VMTemplate table may not exist yet, e.g. during
|
||||
# migrations or initial application setup.
|
||||
vm_template_choices = []
|
||||
|
||||
defaults = {
|
||||
'form_class': forms.MultipleChoiceField,
|
||||
|
|
@ -335,7 +341,6 @@ class MultipleChoiceArrayField(ArrayField):
|
|||
|
||||
defaults.update(kwargs)
|
||||
|
||||
# Skip ArrayField.formfield() because we don't need its implementation.
|
||||
return super(ArrayField, self).formfield(**defaults)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import datetime
|
|||
import logging
|
||||
|
||||
from django import template
|
||||
from from django.urls import reverse import resolve, reverse
|
||||
from django.urls import resolve, reverse
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import activate, get_language, gettext_lazy as _
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue