add admin list filtering and ordering for mail addresses and mailboxes
This commit is contained in:
parent
fe40074cde
commit
19390d369a
3 changed files with 12 additions and 3 deletions
|
@ -1,6 +1,9 @@
|
||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
* :feature:`-` add admin list filtering and ordering for mail addresses and
|
||||||
|
mailboxes
|
||||||
|
|
||||||
* :release:`0.4.0 <2015-01-11>`
|
* :release:`0.4.0 <2015-01-11>`
|
||||||
* :feature:`-` add mysqltasks and pgsqltasks
|
* :feature:`-` add mysqltasks and pgsqltasks
|
||||||
* :feature:`-` add :py:mod:`userdbs` app to allow management of user databases
|
* :feature:`-` add :py:mod:`userdbs` app to allow management of user databases
|
||||||
|
|
|
@ -112,7 +112,7 @@ class MailboxAdmin(ActivationChangeMixin, admin.ModelAdmin):
|
||||||
actions = ['activate', 'deactivate']
|
actions = ['activate', 'deactivate']
|
||||||
|
|
||||||
list_display = ('username', 'osuser', 'active')
|
list_display = ('username', 'osuser', 'active')
|
||||||
list_filter = ('active',)
|
list_filter = ('active', 'osuser')
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, {
|
(None, {
|
||||||
'fields': ('osuser', 'username', 'password', 'active')}),
|
'fields': ('osuser', 'username', 'password', 'active')}),
|
||||||
|
@ -157,8 +157,8 @@ class MailAddressForwardInline(admin.TabularInline):
|
||||||
class MailAddressAdmin(ActivationChangeMixin, admin.ModelAdmin):
|
class MailAddressAdmin(ActivationChangeMixin, admin.ModelAdmin):
|
||||||
actions = ['activate', 'deactivate']
|
actions = ['activate', 'deactivate']
|
||||||
|
|
||||||
list_display = ('__str__', 'active')
|
list_display = ('__str__', 'mailaddressmailbox', 'active')
|
||||||
list_filter = ('active',)
|
list_filter = ('active', 'domain')
|
||||||
|
|
||||||
inlines = [MailAddressMailboxInline, MailAddressForwardInline]
|
inlines = [MailAddressMailboxInline, MailAddressForwardInline]
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ class Mailbox(ActivateAbleMixin, TimeStampedModel, models.Model):
|
||||||
objects = MailboxManager()
|
objects = MailboxManager()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
ordering = ['osuser', 'username']
|
||||||
verbose_name = _('Mailbox')
|
verbose_name = _('Mailbox')
|
||||||
verbose_name_plural = _('Mailboxes')
|
verbose_name_plural = _('Mailboxes')
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ class MailAddress(ActivateAbleMixin, TimeStampedModel, models.Model):
|
||||||
domain = models.ForeignKey(MailDomain)
|
domain = models.ForeignKey(MailDomain)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
ordering = ['domain', 'localpart']
|
||||||
unique_together = ('localpart', 'domain')
|
unique_together = ('localpart', 'domain')
|
||||||
verbose_name = _('Mail address')
|
verbose_name = _('Mail address')
|
||||||
verbose_name_plural = _('Mail addresses')
|
verbose_name_plural = _('Mail addresses')
|
||||||
|
@ -80,6 +82,7 @@ class MailAddress(ActivateAbleMixin, TimeStampedModel, models.Model):
|
||||||
return "{0}@{1}".format(self.localpart, self.domain)
|
return "{0}@{1}".format(self.localpart, self.domain)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class MailAddressMailbox(TimeStampedModel, models.Model):
|
class MailAddressMailbox(TimeStampedModel, models.Model):
|
||||||
mailaddress = models.OneToOneField(MailAddress, primary_key=True)
|
mailaddress = models.OneToOneField(MailAddress, primary_key=True)
|
||||||
mailbox = models.ForeignKey(Mailbox)
|
mailbox = models.ForeignKey(Mailbox)
|
||||||
|
@ -87,6 +90,9 @@ class MailAddressMailbox(TimeStampedModel, models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('mailaddress', 'mailbox')
|
unique_together = ('mailaddress', 'mailbox')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.mailbox.username
|
||||||
|
|
||||||
|
|
||||||
class MailAddressForward(TimeStampedModel, models.Model):
|
class MailAddressForward(TimeStampedModel, models.Model):
|
||||||
mailaddress = models.ForeignKey(MailAddress)
|
mailaddress = models.ForeignKey(MailAddress)
|
||||||
|
|
Loading…
Reference in a new issue