Hello, I'm new to django/python and I'm trying to use django-registration in my first app but I'm having problems rendering the activation_key in the email message i.e., the email_message.txt file passed as the first argument to render_to_string() will render it's own content but the dictionary provided in the second argument is not rendered:
def create_inactive_user(self, username, password, email, send_email=True, profile_callback=None): """ Create a new, inactive ``User``, generates a ``RegistrationProfile`` and email its activation key to the ``User``, returning the new ``User``. To disable the email, call with ``send_email=False``. To enable creation of a custom user profile along with the ``User`` (e.g., the model specified in the ``AUTH_PROFILE_MODULE`` setting), define a function which knows how to create and save an instance of that model with appropriate default values, and pass it as the keyword argument ``profile_callback``. This function should accept one keyword argument: ``user`` The ``User`` to relate the profile to. """ new_user = User.objects.create_user(username, email, password) new_user.is_active = False new_user.save() registration_profile = self.create_profile(new_user) if profile_callback is not None: profile_callback(user=new_user) if send_email: from django.core.mail import send_mail current_site = Site.objects.get_current() subject = render_to_string('registration/ activation_email_subject.txt', { 'site': current_site }) # Email subject *must not* contain newlines subject = ''.join(subject.splitlines()) message = render_to_string('registration/ activation_email.txt', { 'activation_key': registration_profile.activation_key, 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'site': current_site }) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email]) return new_user I'm sure there is a very simple explanation for this, thanks for any help. J --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---