Random fixes
This commit is contained in:
parent
aa34f09fdd
commit
42c696c6ec
|
@ -54,7 +54,7 @@ class Domain(models.Model):
|
|||
|
||||
def get_subdomains(self):
|
||||
""" 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):
|
||||
return type(self).get_top_domain(self.name)
|
||||
|
@ -62,7 +62,7 @@ class Domain(models.Model):
|
|||
def render_zone(self):
|
||||
origin = self.origin
|
||||
zone = origin.render_records()
|
||||
for subdomain in origin.get_subdomains().prefetch_related('records'):
|
||||
for subdomain in origin.get_subdomains():
|
||||
zone += subdomain.render_records()
|
||||
return zone
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class ResourceForm(forms.ModelForm):
|
|||
self.resource = kwargs.pop('resource', None)
|
||||
super(ResourceForm, self).__init__(*args, **kwargs)
|
||||
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
|
||||
if self.resource.on_demand:
|
||||
self.fields['allocated'].required = False
|
||||
|
|
|
@ -122,6 +122,9 @@ class Resource(models.Model):
|
|||
def get_scale(self):
|
||||
return eval(self.scale)
|
||||
|
||||
def get_verbose_name(self):
|
||||
return self.verbose_name or self.name
|
||||
|
||||
|
||||
class ResourceData(models.Model):
|
||||
""" Stores computed resource usage and allocation """
|
||||
|
|
|
@ -22,7 +22,9 @@ class PlanAdmin(ExtendedModelAdmin):
|
|||
list_display = ('name', 'is_default', 'is_combinable', 'allow_multiple')
|
||||
list_filter = ('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',)
|
||||
inlines = [RateInline]
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ class WebsiteAdmin(SelectAccountAdminMixin, ExtendedModelAdmin):
|
|||
return '<br>'.join(domains)
|
||||
display_domains.short_description = _("domains")
|
||||
display_domains.allow_tags = True
|
||||
display_domains.admin_order_field = 'domains'
|
||||
|
||||
def display_webapps(self, website):
|
||||
webapps = []
|
||||
|
|
|
@ -26,11 +26,11 @@ WEBSITES_OPTIONS = getattr(settings, 'WEBSITES_OPTIONS', {
|
|||
),
|
||||
'redirect': (
|
||||
_("HTTPD - Redirection"),
|
||||
_("[permanent] <website path> <destination URL>"),
|
||||
_("<tt>[permanent] <website path> <destination URL></tt>"),
|
||||
r'^(permanent\s[^ ]+|[^ ]+)\s[^ ]+$',
|
||||
),
|
||||
'ssl_ca': (
|
||||
_("HTTPD - SSL CA"),
|
||||
"HTTPD - SSL CA",
|
||||
_("Filesystem path of the CA certificate file."),
|
||||
r'^[^ ]+$'
|
||||
),
|
||||
|
@ -45,21 +45,31 @@ WEBSITES_OPTIONS = getattr(settings, 'WEBSITES_OPTIONS', {
|
|||
r'^[^ ]+$',
|
||||
),
|
||||
'sec_rule_remove': (
|
||||
_("HTTPD - SecRuleRemoveById"),
|
||||
"HTTPD - SecRuleRemoveById",
|
||||
_("Space separated ModSecurity rule IDs."),
|
||||
r'^[0-9\s]+$',
|
||||
),
|
||||
'sec_engine': (
|
||||
_("HTTPD - Modsecurity engine"),
|
||||
_("On or Off, defaults to On"),
|
||||
"HTTPD - Modsecurity engine",
|
||||
_("<tt>On</tt> or <tt>Off</tt>, defaults to On"),
|
||||
r'^(On|Off)$',
|
||||
),
|
||||
'user_group': (
|
||||
_("HTTPD - SuexecUserGroup"),
|
||||
_("Username and optional groupname (user [group])"),
|
||||
"HTTPD - SuexecUserGroup",
|
||||
_("<tt>user [group]</tt>, username and optional groupname."),
|
||||
# TODO validate existing user/group
|
||||
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