change Mailbox admin to work with osuser field

This commit is contained in:
Jan Dittberner 2014-05-24 22:56:33 +02:00
parent f085dab017
commit da8ba6ed1d

View file

@ -49,7 +49,7 @@ class MailboxCreationForm(forms.ModelForm):
class Meta: class Meta:
model = Mailbox model = Mailbox
fields = ('username',) fields = ('osuser',)
def clean_password2(self): def clean_password2(self):
""" """
@ -69,8 +69,6 @@ class MailboxCreationForm(forms.ModelForm):
""" """
mailbox = super(MailboxCreationForm, self).save(commit=False) mailbox = super(MailboxCreationForm, self).save(commit=False)
mailbox.set_password(self.cleaned_data['password1']) mailbox.set_password(self.cleaned_data['password1'])
mailbox.uid = 0
mailbox.gid = 0
if commit: if commit:
mailbox.save() mailbox.save()
return mailbox return mailbox
@ -85,7 +83,7 @@ class MailboxChangeForm(forms.ModelForm):
class Meta: class Meta:
model = Mailbox model = Mailbox
fields = ('username', 'password', 'home', 'uid', 'gid', 'active') fields = ('username', 'password', 'osuser', 'active')
def clean_password(self): def clean_password(self):
return self.initial['password'] return self.initial['password']
@ -112,13 +110,11 @@ class MailboxAdmin(ActivationChangeMixin, admin.ModelAdmin):
actions = ['activate', 'deactivate'] actions = ['activate', 'deactivate']
list_display = ('username', 'active') list_display = ('username', 'osuser', 'active')
list_filter = ('active',) list_filter = ('active',)
fieldsets = ( fieldsets = (
(None, { (None, {
'fields': ('username', 'password', 'active')}), 'fields': ('username', 'password', 'osuser', 'active')}),
(_('System'), {
'fields': ('home', 'uid', 'gid')}),
) )
add_fieldsets = ( add_fieldsets = (
(None, { (None, {