Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ARN
coin
Commits
c4a3826b
Commit
c4a3826b
authored
Mar 17, 2019
by
jocelyn
Browse files
Merge branch 'jd-reprise-subscribe-notification'
Reprise de la PR
https://code.ffdn.org/FFDN/coin/pulls/176
parents
37f96d78
2eb90b19
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
c4a3826b
...
...
@@ -384,6 +384,8 @@ MEMBERSHIP_FEE_REMINDER_DATES = [
-
`SITE_TITLE`
: the base of site title (displayed in browser window/tab title)
-
`SITE_HEADER`
: the site header (displayed in all pages as page header)
-
`SITE_LOGO_URL`
: URL to website logo (by default, this is an ascii-duck)
-
`SUBSCRIPTIONS_NOTIFICATION_EMAILS`
: Emails on which to send notifications
uppon new registration.
Accounting logs
---------------
...
...
coin/members/models.py
View file @
c4a3826b
...
...
@@ -15,7 +15,10 @@ from django.core.validators import RegexValidator
from
django.core.exceptions
import
ValidationError
from
django.utils
import
timezone
from
django.utils.text
import
slugify
from
django.core.mail
import
send_mail
from
django.core.urlresolvers
import
reverse
from
ldapdb.models.fields
import
CharField
,
IntegerField
,
ListField
from
registration.signals
import
user_registered
from
coin.offers.models
import
Offer
,
OfferSubscription
from
coin.mixins
import
CoinLdapSyncMixin
...
...
@@ -59,6 +62,21 @@ class MemberManager(UserManager):
offers
=
Offer
.
objects
.
manageable_by
(
user
)
return
super
(
MemberManager
,
self
).
filter
(
offersubscription__offer__in
=
offers
).
distinct
()
@
receiver
(
user_registered
)
def
send_registration_notification
(
sender
,
user
,
request
=
None
,
**
kwargs
):
"""
Send a notification to the admin if a user subscribe
"""
relative_link
=
reverse
(
'admin:members_member_change'
,
args
=
[
user
.
id
])
edit_link
=
request
.
build_absolute_uri
(
relative_link
)
if
settings
.
SUBSCRIPTIONS_NOTIFICATION_EMAILS
:
utils
.
send_templated_email
(
to
=
settings
.
SUBSCRIPTIONS_NOTIFICATION_EMAILS
,
subject_template
=
'members/emails/new_member_email_subject.txt'
,
body_template
=
'members/emails/new_member_email.html'
,
context
=
{
'member'
:
user
,
'edit_link'
:
edit_link
},
)
class
Member
(
CoinLdapSyncMixin
,
AbstractUser
):
...
...
coin/members/templates/members/emails/new_member_email.html
0 → 100644
View file @
c4a3826b
Bonjour,
<br
/>
<p>
{{ member }} s'est enregistré⋅e sur l'espace adhérent
(COIN).
</p>
<p>
Lien d'édition:
<a
href=
"{{ edit_link }}"
>
{{ edit_link }}
</a></p>
Bisou,
Votre canard dévoué
coin/members/templates/members/emails/new_member_email_subject.txt
0 → 100644
View file @
c4a3826b
[COIN] Nouveau compte créé
coin/settings_base.py
View file @
c4a3826b
...
...
@@ -16,6 +16,9 @@ ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
# Email on which to send emails
SUBSCRIPTIONS_NOTIFICATION_EMAILS
=
[]
MANAGERS
=
ADMINS
DATABASES
=
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment