fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a199e40
)
notification for new organizations
author
Jan Szejko
<janek37@gmail.com>
Thu, 19 Jan 2017 12:35:07 +0000
(13:35 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Thu, 19 Jan 2017 12:35:07 +0000
(13:35 +0100)
apps/organizations/forms.py
patch
|
blob
|
history
diff --git
a/apps/organizations/forms.py
b/apps/organizations/forms.py
index
6398448
..
298da48
100644
(file)
--- a/
apps/organizations/forms.py
+++ b/
apps/organizations/forms.py
@@
-4,6
+4,10
@@
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import forms
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import forms
+from constance import config
+from django.contrib.sites.models import Site
+from django.core.mail import send_mail
+
from .models import Organization, UserCard, countries
from .models import Organization, UserCard, countries
@@
-14,6
+18,18
@@
class OrganizationForm(forms.ModelForm):
model = Organization
exclude = ['_html']
model = Organization
exclude = ['_html']
+ def save(self, commit=True):
+ organization = super(OrganizationForm, self).save(commit=commit)
+ site = Site.objects.get_current()
+ send_mail(
+ 'New organization in MIL/PEER',
+ '''New organization in MIL/PEER: %s. View their profile: https://%s%s.
+
+--
+MIL/PEER team.''' % (organization.name, site.domain, organization.get_absolute_url()),
+ 'milpeer@mdrn.pl', [config.NOTIFY_EMAIL])
+ return organization
+
class UserCardForm(forms.ModelForm):
cts = countries
class UserCardForm(forms.ModelForm):
cts = countries