From 350d51655abaf66e7b2a3cfb4be612c3e5627679 Mon Sep 17 00:00:00 2001 From: Chris Wendel <33882314+WisChrendel@users.noreply.github.com> Date: Tue, 13 Nov 2018 10:28:06 -0600 Subject: [PATCH] Update FAQ to Work with Current Version of Django Updated the "Hackery" to move the new fields to the front of the OrderedDict with move_to_end('*key*', last=False). Updated user_profile = new_user.get_profile() to user_profile = new_user.my_profile. get_profile() has been deprecated. --- docs/faq.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index cefff585..e9ee3e27 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -118,10 +118,10 @@ form. First you override the signup form and add the fields. """ super(SignupFormExtra, self).__init__(*args, **kw) # Put the first and last name at the top - new_order = self.fields.keyOrder[:-2] - new_order.insert(0, 'first_name') - new_order.insert(1, 'last_name') - self.fields.keyOrder = new_order + new_order = self.fields + new_order.move_to_end('last_name', last=False) + new_order.move_to_end('first_name', last=False) + self.fields= new_order def save(self): """ @@ -135,7 +135,7 @@ form. First you override the signup form and add the fields. # Get the profile, the `save` method above creates a profile for each # user because it calls the manager method `create_user`. # See: https://github.com/bread-and-pepper/django-userena/blob/master/userena/managers.py#L65 - user_profile = new_user.get_profile() + user_profile = new_user.my_profile user_profile.first_name = self.cleaned_data['first_name'] user_profile.last_name = self.cleaned_data['last_name']