Add aliases
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 5 Apr 2019 07:40:45 +0000 (09:40 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 5 Apr 2019 08:21:26 +0000 (10:21 +0200)
src/cas/settings.py
src/emails/__init__.py [new file with mode: 0644]
src/emails/admin.py [new file with mode: 0644]
src/emails/apps.py [new file with mode: 0644]
src/emails/locale/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
src/emails/locale/pl/LC_MESSAGES/django.po [new file with mode: 0644]
src/emails/migrations/0001_initial.py [new file with mode: 0644]
src/emails/migrations/__init__.py [new file with mode: 0644]
src/emails/models.py [new file with mode: 0644]

index 935f972..4101776 100644 (file)
@@ -84,6 +84,7 @@ LOCALE_PATHS = (
 
 INSTALLED_APPS = (
     'accounts.apps.AccountsConfig',
+    'emails.apps.EmailsConfig',
     'services.apps.ServicesConfig',
     'ssh_keys.apps.SshKeysConfig',
 
diff --git a/src/emails/__init__.py b/src/emails/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/emails/admin.py b/src/emails/admin.py
new file mode 100644 (file)
index 0000000..41372c0
--- /dev/null
@@ -0,0 +1,9 @@
+from django.contrib import admin
+from . import models
+
+
+class AliasAdmin(admin.ModelAdmin):
+    list_display = ['source', 'destination']
+
+
+admin.site.register(models.Alias, AliasAdmin)
diff --git a/src/emails/apps.py b/src/emails/apps.py
new file mode 100644 (file)
index 0000000..5ca33e9
--- /dev/null
@@ -0,0 +1,7 @@
+from django.apps import AppConfig
+from django.utils.translation import ugettext_lazy as _
+
+
+class EmailsConfig(AppConfig):
+    name = 'emails'
+    verbose_name = _('E-mails')
diff --git a/src/emails/locale/pl/LC_MESSAGES/django.mo b/src/emails/locale/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..20f93c7
Binary files /dev/null and b/src/emails/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/src/emails/locale/pl/LC_MESSAGES/django.po b/src/emails/locale/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..a5c2125
--- /dev/null
@@ -0,0 +1,41 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+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"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n"
+"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n"
+"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
+"X-Generator: Poedit 2.0.6\n"
+
+#: apps.py:7
+msgid "E-mails"
+msgstr "E-maile"
+
+#: models.py:6
+msgid "source"
+msgstr "źródło"
+
+#: models.py:7
+msgid "destination"
+msgstr "cel"
+
+#: models.py:10
+msgid "alias"
+msgstr "alias"
+
+#: models.py:11
+msgid "aliases"
+msgstr "aliasy"
diff --git a/src/emails/migrations/0001_initial.py b/src/emails/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..3ce50fa
--- /dev/null
@@ -0,0 +1,27 @@
+# Generated by Django 2.2 on 2019-04-05 07:37
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Alias',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('source', models.EmailField(db_index=True, max_length=254, verbose_name='source')),
+                ('destination', models.EmailField(max_length=254, verbose_name='destination')),
+            ],
+            options={
+                'verbose_name': 'alias',
+                'verbose_name_plural': 'aliases',
+                'ordering': ('source', 'destination'),
+            },
+        ),
+    ]
diff --git a/src/emails/migrations/__init__.py b/src/emails/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/emails/models.py b/src/emails/models.py
new file mode 100644 (file)
index 0000000..f44939f
--- /dev/null
@@ -0,0 +1,15 @@
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+
+class Alias(models.Model):
+    source = models.EmailField(_('source'), db_index=True)
+    destination = models.EmailField(_('destination'))
+
+    class Meta:
+        verbose_name = _('alias')
+        verbose_name_plural = _('aliases')
+        ordering = ('source', 'destination')
+
+    def __str__(self):
+        return '{} -> {}'.format(self.source, self.destination)