Closed sircco closed 6 years ago
Somewhat related to #54
@sircco does the fix in https://github.com/macropin/django-registration/pull/54 solve your problem?
looking at code, i don't think that this does it unless i can override this line on per case basis.
from_email = getattr(settings, 'REGISTRATION_DEFAULT_FROM_EMAIL', settings.DEFAULT_FROM_EMAIL)
Our app is whitelabel, meaning that more than one domain can use it, register its own customers (and send registration emails)
@sircco the use case makes sense 👍
If you'd like to implement we are happy to review.
strawman could be to allow REGISTRATION_DEFAULT_FROM_EMAIL
to be a python dotted path.to.function
which would point a function that take site
as an argument and does custom logic to return the email? Thoughts?
# settings.py
REGISTRATION_DEFAULT_FROM_EMAIL = 'path.to.function'
# path/to.py
def function(site):
return 'example@example.com'
(probably cleaner to have a separate settings variable REGISTRATION_FROM_EMAIL_FUNCTION
or similar but same idea)
How about something like this, overriding default if variable not provided during instantiation. I didnt look too much at the code recently but here is some dummy code to explain my idea.
class Registration(Object): def init_(self, mail_from=None, .... ): self.mail_from, = mail_from or settings.REGISTRATION_DEFAULT_FROM_EMAIL
On Tue, Jun 7, 2016 at 6:14 AM, Joshua Blum notifications@github.com wrote:
(probably cleaner to have a separate settings variable REGISTRATION_FROM_EMAIL_FUNCTION but same idea)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/macropin/django-registration/issues/26#issuecomment-224170248, or mute the thread https://github.com/notifications/unsubscribe/AJ9osiYzs0R4cFXyRZeY07tAUzef4qE-ks5qJPASgaJpZM4Da72R .
I think it's acceptable to use static configuration for this as well. You can use a dictionary to map emails to sites, just as an example.
@sircco would a static configuration meet your use case?
It will work for now. If we get so much traffic on our whitelabel site that we can't manage static setting we will think of something and submit code for review.
Great. Do you want to take a first stab at implementing this? El El mié, jun 15, 2016 a las 01:14, Damir notifications@github.com escribió:
It will work for now. If we get so much traffic on our whitelabel site that we can't manage static setting we will think of something and submit code for review.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/macropin/django-registration/issues/26#issuecomment-226089853, or mute the thread https://github.com/notifications/unsubscribe/ABF01NyzOHc4NZQXqii166U7mMXFzlHSks5qL4pFgaJpZM4Da72R .
@sircco take a look at #294 and let me know if this address your use case!
should work fine!
Awesome! I'll leave this open until #294 is merged in
closed by #294
Since it is already possible to use site for email notifications it would be great if it could be possible to override settings.DEFAULT_FROM_ADDRESS from function