macropin / django-registration

Django-registration (redux) provides user registration functionality for Django websites.
http://django-registration-redux.readthedocs.org
Other
974 stars 348 forks source link

missing user context variable in admin_approve_complete_email template #348

Closed jonas87 closed 5 years ago

jonas87 commented 5 years ago

The admin_approve_complete_email context is missing the user variable. In for example the activation_email template, the user variable is available. It makes sense to have the user also available in admin_approve_complete_email since both of these templates are for emails that are send to the new user.

joshblum commented 5 years ago

hey @jonas87 the admin_approve_complete_email context (https://github.com/macropin/django-registration/blob/master/registration/models.py#L693) and the activation_email context (https://github.com/macropin/django-registration/blob/master/registration/models.py#L419) have a user variable present, this just wasn't documented properly. Added docs in: https://github.com/macropin/django-registration/pull/349

jonas87 commented 5 years ago

Thanks for the links @joshblum, I see the problem now. In virtually all templates the user context variable gives access to the full user object (self.user). In admin_approve_complete_email however the user variable refers to self.user.get_username(). That's a bit inconsistent? I was calling user.first_name in all my templates, which I see now of course works in the self.user templates but not in the self.user.get_username() templates. I will define get_username() then in my user model to work around this

joshblum commented 5 years ago

Ah you’re right, I’ll drop make the full user available, sorry I missed that when I was looking earlier

joshblum commented 5 years ago

https://github.com/macropin/django-registration/pull/350