implement automatic creation of mailbox names
- create mailbox name when saving new mailboxes in admin - add MailboxManager that implement get_next_mailbox_name as manager for Mailbox
This commit is contained in:
parent
8f5812ff29
commit
92c6b39e12
3 changed files with 24 additions and 1 deletions
|
@ -67,6 +67,8 @@ class MailboxCreationForm(forms.ModelForm):
|
|||
|
||||
"""
|
||||
mailbox = super(MailboxCreationForm, self).save(commit=False)
|
||||
mailbox.username = Mailbox.objects.get_next_mailbox_name(
|
||||
mailbox.osuser)
|
||||
mailbox.set_password(self.cleaned_data['password1'])
|
||||
if commit:
|
||||
mailbox.save()
|
||||
|
@ -118,7 +120,7 @@ class MailboxAdmin(ActivationChangeMixin, admin.ModelAdmin):
|
|||
add_fieldsets = (
|
||||
(None, {
|
||||
'classes': ('wide',),
|
||||
'fields': ('osuser', 'username', 'password1', 'password2')}),
|
||||
'fields': ('osuser', 'password1', 'password2')}),
|
||||
)
|
||||
search_fields = ('username',)
|
||||
ordering = ('username',)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue