Fixes on domain management0

This commit is contained in:
Marc 2014-10-24 11:10:30 +00:00
parent 3b435bb655
commit 86745f16e7
4 changed files with 12 additions and 4 deletions

View File

@ -176,3 +176,6 @@ Remember that, as always with QuerySets, any subsequent chained methods which im
* REST PERMISSIONS * REST PERMISSIONS
* caching based on def text2int(textnum, numwords={}): * caching based on def text2int(textnum, numwords={}):
* Subdomain saving should not trigger bind slave

View File

@ -205,6 +205,8 @@ class BillContactInline(admin.StackedInline):
def formfield_for_dbfield(self, db_field, **kwargs): def formfield_for_dbfield(self, db_field, **kwargs):
""" Make value input widget bigger """ """ Make value input widget bigger """
if db_field.name == 'name':
kwargs['widget'] = forms.TextInput(attrs={'size':'70'})
if db_field.name == 'address': if db_field.name == 'address':
kwargs['widget'] = forms.Textarea(attrs={'cols': 70, 'rows': 2}) kwargs['widget'] = forms.Textarea(attrs={'cols': 70, 'rows': 2})
if db_field.name == 'email_usage': if db_field.name == 'email_usage':

View File

@ -35,15 +35,19 @@ class RecordInline(admin.TabularInline):
class DomainInline(admin.TabularInline): class DomainInline(admin.TabularInline):
# TODO account, and record sumary fields
model = Domain model = Domain
fields = ('domain_link',) fields = ('domain_link', 'display_records', 'account_link')
readonly_fields = ('domain_link',) readonly_fields = ('domain_link', 'display_records', 'account_link')
extra = 0 extra = 0
verbose_name_plural = _("Subdomains") verbose_name_plural = _("Subdomains")
domain_link = admin_link('__unicode__') domain_link = admin_link('__unicode__')
domain_link.short_description = _("Name") domain_link.short_description = _("Name")
account_link = admin_link('account')
def display_records(self, domain):
return ', '.join(domain.records.values_list('type', flat=True))
display_records.short_description = _("Declared records")
def has_add_permission(self, *args, **kwargs): def has_add_permission(self, *args, **kwargs):
return False return False

View File

@ -145,7 +145,6 @@ class Domain(models.Model):
for domain in domains.filter(name__endswith=self.name): for domain in domains.filter(name__endswith=self.name):
domain.top = self domain.top = self
domain.save(update_fields=['top']) domain.save(update_fields=['top'])
self.subdomains.update(account_id=self.account_id)
class Record(models.Model): class Record(models.Model):