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