Skip to content

Commit 58dbc76

Browse files
author
Walter Renner
committed
New migrations are no longer made for every settings.ADMINS change
1 parent 3d6388c commit 58dbc76

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations, models
5+
import cmsplugin_contact_plus.models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('cmsplugin_contact_plus', '0004_auto_20170410_1553'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='contactplus',
17+
name='recipient_email',
18+
field=models.EmailField(verbose_name='Email of recipients', max_length=254, default=cmsplugin_contact_plus.models.get_default_from_email_address),
19+
),
20+
]

cmsplugin_contact_plus/models.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111

1212
from cmsplugin_contact_plus import local_settings
1313

14-
try:
15-
DEFAULT_FROM_EMAIL_ADDRESS = settings.ADMINS[0][1]
16-
except:
17-
DEFAULT_FROM_EMAIL_ADDRESS = ''
14+
15+
def get_default_from_email_address():
16+
email_address = ''
17+
try:
18+
email_address = settings.ADMINS[0][1]
19+
except:
20+
pass
21+
22+
return email_address
23+
1824

1925
def get_current_site():
2026
try:
@@ -36,7 +42,7 @@ class ContactPlus(CMSPlugin):
3642
verbose_name=_("Email subject"),
3743
default=get_current_site)
3844
recipient_email = models.EmailField(_("Email of recipients"),
39-
default=DEFAULT_FROM_EMAIL_ADDRESS,
45+
default=get_default_from_email_address,
4046
max_length=254)
4147
collect_records = models.BooleanField(_('Collect Records'),
4248
default=True,

0 commit comments

Comments
 (0)