From 53c0f2de2c0447a5b7518e1a0ac2d09461930ae8 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 5 Apr 2019 11:34:48 +0200 Subject: [PATCH 1/1] Add mode. --- src/emails/admin.py | 4 +++- src/emails/locale/pl/LC_MESSAGES/django.mo | Bin 682 -> 873 bytes src/emails/locale/pl/LC_MESSAGES/django.po | 18 +++++++++++++++--- src/emails/migrations/0002_alias_mode.py | 18 ++++++++++++++++++ src/emails/models.py | 5 +++++ 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/emails/migrations/0002_alias_mode.py diff --git a/src/emails/admin.py b/src/emails/admin.py index 41372c0..fee152d 100644 --- a/src/emails/admin.py +++ b/src/emails/admin.py @@ -3,7 +3,9 @@ from . import models class AliasAdmin(admin.ModelAdmin): - list_display = ['source', 'destination'] + search_fields = ['source', 'destination'] + list_display = ['source', 'destination', 'mode'] + list_filter = ['mode'] admin.site.register(models.Alias, AliasAdmin) diff --git a/src/emails/locale/pl/LC_MESSAGES/django.mo b/src/emails/locale/pl/LC_MESSAGES/django.mo index 20f93c78972894419bf59d5d062534c0ba6a6887..55a8ea7a8c281885a4919e22ce8544c89d5e4b5c 100644 GIT binary patch delta 427 zcmY+8yGjE=6o$`gHYy@QS}g`eurXv2EW}1o(Z)+-VI$-2m`wIEVRkj_HUZxtg_Un0 z7DB9SWg8ztwDcha|Fa>8hxz8)Ih^@-9^LQy;Go)F7a1|VPqVi_Rz0b*_-t^r~YSOLWBK)e!&S%G*Xl)oKFgVgN@Vvyd` zK)i*Kf#DL62B~jnf~fBY(jfV%K$;my&jHe$Kzad?1}ZlMOM)a=fEWfq7Qp~e9R#@Q z<|bz56i-%Ul%DL!7{F>^X=P%(c^YFnqcTJ)l_4=FGqD&#Rx%`~<}e)HRdjfB%F(8L F1^^V3BK!aV diff --git a/src/emails/locale/pl/LC_MESSAGES/django.po b/src/emails/locale/pl/LC_MESSAGES/django.po index a5c2125..df146cb 100644 --- a/src/emails/locale/pl/LC_MESSAGES/django.po +++ b/src/emails/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-04-05 09:43+0200\n" -"PO-Revision-Date: 2019-04-05 09:43+0200\n" +"POT-Creation-Date: 2019-04-05 11:31+0200\n" +"PO-Revision-Date: 2019-04-05 11:31+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: pl\n" @@ -32,10 +32,22 @@ msgstr "źródło" msgid "destination" msgstr "cel" +#: models.py:8 +msgid "mode" +msgstr "tryb" + +#: models.py:9 +msgid "Forward everything" +msgstr "Przekazuj wszystko" + #: models.py:10 +msgid "Do not forward e-mail marked as spam." +msgstr "Nie przekazuj wiadomości oznaczonych jako spam." + +#: models.py:14 msgid "alias" msgstr "alias" -#: models.py:11 +#: models.py:15 msgid "aliases" msgstr "aliasy" diff --git a/src/emails/migrations/0002_alias_mode.py b/src/emails/migrations/0002_alias_mode.py new file mode 100644 index 0000000..573fb30 --- /dev/null +++ b/src/emails/migrations/0002_alias_mode.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2019-04-05 09:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('emails', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='alias', + name='mode', + field=models.CharField(blank=True, choices=[('', 'Forward everything'), ('@FORWARD', 'Do not forward e-mail marked as spam.')], default='', max_length=255, verbose_name='mode'), + ), + ] diff --git a/src/emails/models.py b/src/emails/models.py index f44939f..988b5a1 100644 --- a/src/emails/models.py +++ b/src/emails/models.py @@ -5,6 +5,11 @@ from django.utils.translation import ugettext_lazy as _ class Alias(models.Model): source = models.EmailField(_('source'), db_index=True) destination = models.EmailField(_('destination')) + mode = models.CharField( + _('mode'), max_length=255, default='', blank=True, choices=[ + ('', _('Forward everything')), + ('@FORWARD', _('Do not forward e-mail marked as spam.')) + ]) class Meta: verbose_name = _('alias') -- 2.20.1