Random fixes
This commit is contained in:
parent
aa34f09fdd
commit
42c696c6ec
|
@ -54,7 +54,7 @@ class Domain(models.Model):
|
||||||
|
|
||||||
def get_subdomains(self):
|
def get_subdomains(self):
|
||||||
""" proxy method, needed for input validation, see helpers.domain_for_validation """
|
""" proxy method, needed for input validation, see helpers.domain_for_validation """
|
||||||
return self.origin.subdomain_set.all()
|
return self.origin.subdomain_set.all().prefetch_related('records')
|
||||||
|
|
||||||
def get_top(self):
|
def get_top(self):
|
||||||
return type(self).get_top_domain(self.name)
|
return type(self).get_top_domain(self.name)
|
||||||
|
@ -62,7 +62,7 @@ class Domain(models.Model):
|
||||||
def render_zone(self):
|
def render_zone(self):
|
||||||
origin = self.origin
|
origin = self.origin
|
||||||
zone = origin.render_records()
|
zone = origin.render_records()
|
||||||
for subdomain in origin.get_subdomains().prefetch_related('records'):
|
for subdomain in origin.get_subdomains():
|
||||||
zone += subdomain.render_records()
|
zone += subdomain.render_records()
|
||||||
return zone
|
return zone
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ResourceForm(forms.ModelForm):
|
||||||
self.resource = kwargs.pop('resource', None)
|
self.resource = kwargs.pop('resource', None)
|
||||||
super(ResourceForm, self).__init__(*args, **kwargs)
|
super(ResourceForm, self).__init__(*args, **kwargs)
|
||||||
if self.resource:
|
if self.resource:
|
||||||
self.fields['verbose_name'].initial = self.resource.verbose_name
|
self.fields['verbose_name'].initial = self.resource.get_verbose_name()
|
||||||
self.fields['unit'].initial = self.resource.unit
|
self.fields['unit'].initial = self.resource.unit
|
||||||
if self.resource.on_demand:
|
if self.resource.on_demand:
|
||||||
self.fields['allocated'].required = False
|
self.fields['allocated'].required = False
|
||||||
|
|
|
@ -121,6 +121,9 @@ class Resource(models.Model):
|
||||||
|
|
||||||
def get_scale(self):
|
def get_scale(self):
|
||||||
return eval(self.scale)
|
return eval(self.scale)
|
||||||
|
|
||||||
|
def get_verbose_name(self):
|
||||||
|
return self.verbose_name or self.name
|
||||||
|
|
||||||
|
|
||||||
class ResourceData(models.Model):
|
class ResourceData(models.Model):
|
||||||
|
|
|
@ -22,7 +22,9 @@ class PlanAdmin(ExtendedModelAdmin):
|
||||||
list_display = ('name', 'is_default', 'is_combinable', 'allow_multiple')
|
list_display = ('name', 'is_default', 'is_combinable', 'allow_multiple')
|
||||||
list_filter = ('is_default', 'is_combinable', 'allow_multiple')
|
list_filter = ('is_default', 'is_combinable', 'allow_multiple')
|
||||||
fields = ('verbose_name', 'name', 'is_default', 'is_combinable', 'allow_multiple')
|
fields = ('verbose_name', 'name', 'is_default', 'is_combinable', 'allow_multiple')
|
||||||
prepopulated_fields = {'name': ('verbose_name',)}
|
prepopulated_fields = {
|
||||||
|
'name': ('verbose_name',)
|
||||||
|
}
|
||||||
change_readonly_fields = ('name',)
|
change_readonly_fields = ('name',)
|
||||||
inlines = [RateInline]
|
inlines = [RateInline]
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ class WebsiteAdmin(SelectAccountAdminMixin, ExtendedModelAdmin):
|
||||||
return '<br>'.join(domains)
|
return '<br>'.join(domains)
|
||||||
display_domains.short_description = _("domains")
|
display_domains.short_description = _("domains")
|
||||||
display_domains.allow_tags = True
|
display_domains.allow_tags = True
|
||||||
|
display_domains.admin_order_field = 'domains'
|
||||||
|
|
||||||
def display_webapps(self, website):
|
def display_webapps(self, website):
|
||||||
webapps = []
|
webapps = []
|
||||||
|
|
|
@ -26,11 +26,11 @@ WEBSITES_OPTIONS = getattr(settings, 'WEBSITES_OPTIONS', {
|
||||||
),
|
),
|
||||||
'redirect': (
|
'redirect': (
|
||||||
_("HTTPD - Redirection"),
|
_("HTTPD - Redirection"),
|
||||||
_("[permanent] <website path> <destination URL>"),
|
_("<tt>[permanent] <website path> <destination URL></tt>"),
|
||||||
r'^(permanent\s[^ ]+|[^ ]+)\s[^ ]+$',
|
r'^(permanent\s[^ ]+|[^ ]+)\s[^ ]+$',
|
||||||
),
|
),
|
||||||
'ssl_ca': (
|
'ssl_ca': (
|
||||||
_("HTTPD - SSL CA"),
|
"HTTPD - SSL CA",
|
||||||
_("Filesystem path of the CA certificate file."),
|
_("Filesystem path of the CA certificate file."),
|
||||||
r'^[^ ]+$'
|
r'^[^ ]+$'
|
||||||
),
|
),
|
||||||
|
@ -45,21 +45,31 @@ WEBSITES_OPTIONS = getattr(settings, 'WEBSITES_OPTIONS', {
|
||||||
r'^[^ ]+$',
|
r'^[^ ]+$',
|
||||||
),
|
),
|
||||||
'sec_rule_remove': (
|
'sec_rule_remove': (
|
||||||
_("HTTPD - SecRuleRemoveById"),
|
"HTTPD - SecRuleRemoveById",
|
||||||
_("Space separated ModSecurity rule IDs."),
|
_("Space separated ModSecurity rule IDs."),
|
||||||
r'^[0-9\s]+$',
|
r'^[0-9\s]+$',
|
||||||
),
|
),
|
||||||
'sec_engine': (
|
'sec_engine': (
|
||||||
_("HTTPD - Modsecurity engine"),
|
"HTTPD - Modsecurity engine",
|
||||||
_("On or Off, defaults to On"),
|
_("<tt>On</tt> or <tt>Off</tt>, defaults to On"),
|
||||||
r'^(On|Off)$',
|
r'^(On|Off)$',
|
||||||
),
|
),
|
||||||
'user_group': (
|
'user_group': (
|
||||||
_("HTTPD - SuexecUserGroup"),
|
"HTTPD - SuexecUserGroup",
|
||||||
_("Username and optional groupname (user [group])"),
|
_("<tt>user [group]</tt>, username and optional groupname."),
|
||||||
# TODO validate existing user/group
|
# TODO validate existing user/group
|
||||||
r'^[\w/_]+(\s[\w/_]+)*$',
|
r'^[\w/_]+(\s[\w/_]+)*$',
|
||||||
),
|
),
|
||||||
|
# TODO backend support
|
||||||
|
'error_document': (
|
||||||
|
"HTTPD - ErrorDocumentRoot",
|
||||||
|
_("<error code> <URL/path/message><br>"
|
||||||
|
"<tt> 500 http://foo.example.com/cgi-bin/tester</tt><br>"
|
||||||
|
"<tt> 404 /cgi-bin/bad_urls.pl</tt><br>"
|
||||||
|
"<tt> 401 /subscription_info.html</tt><br>"
|
||||||
|
"<tt> 403 \"Sorry can't allow you access today\"</tt>"),
|
||||||
|
r'[45]0[0-9]\s.*',
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue