From 4733622ff8934087a7dbd5ca88cdd067d7ea07aa Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Thu, 4 Feb 2016 08:41:42 +0100 Subject: [PATCH] Make sure to load types at runtime. see #831 --- modoboa/admin/forms/domain.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modoboa/admin/forms/domain.py b/modoboa/admin/forms/domain.py index 71b1ad208..7d4806168 100644 --- a/modoboa/admin/forms/domain.py +++ b/modoboa/admin/forms/domain.py @@ -22,7 +22,6 @@ from ..models import ( DOMAIN_TYPES = [ ("domain", _("Domain")), ] -DOMAIN_TYPES += events.raiseQueryEvent("ExtraDomainTypes") class DomainFormGeneral(forms.ModelForm, DynamicForm): @@ -30,7 +29,7 @@ class DomainFormGeneral(forms.ModelForm, DynamicForm): """A form to create/edit a domain.""" type = forms.ChoiceField( - label=ugettext_lazy("Type"), choices=DOMAIN_TYPES + label=ugettext_lazy("Type"), ) quota = forms.IntegerField( label=ugettext_lazy("Quota"), @@ -59,6 +58,9 @@ class DomainFormGeneral(forms.ModelForm, DynamicForm): self.oldname = kwargs["instance"].name super(DomainFormGeneral, self).__init__(*args, **kwargs) + self.fields["type"].choices = ( + DOMAIN_TYPES + events.raiseQueryEvent("ExtraDomainTypes")) + self.field_widths = { "quota": 3 }