title: How to create a profile registration form in Django?
body: <p>I am trying to create a custom registration form, but I don't really know how to do it since I am trying to connect the default django registration with a new model.</p>
  
  <p>here is what it looks like, it might be wrong but I am thinking to something like this.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Profile(models.Model):
      user = models.OneToOneField(User)
      name = models.CharField(max_length=20, blank=True, null=True)
      description = models.TextField(max_length=400)
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def register_user(request):
      if request.user.is_authenticated():
          return HttpResponseRedirect('/user/')
      else:
          if request.method == 'POST':
              form = MyRegistrationForm(request.POST)
              if form.is_valid():
                  form.save()
                  return HttpResponseRedirect('/user/')
  
          context = {'profil':Profile.objects.all()}
          context.update(csrf(request))
          context['form'] = MyRegistrationForm()
  
          return render(request, 'register.html', context)
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>class MyRegistrationForm(UserCreationForm):
      email = forms.EmailField(required=True)
  
      class Meta:
          model = User
          fields = {'username', 'password1', 'password2', 'email'}
  
      def save(self, commit=True):
  
          my_user = super(MyRegistrationForm, self).save(commit=False)
          my_user.email = self.cleaned_data['email']
  
          new_profile = Profile(user=my_user, name="John", description="a person")
  
          if commit:
              new_profile.save()
  
          return new_profile
  </code></pre>
  
  <p><strong>register.py</strong></p>
  
  <pre><code>&lt;form action="/user/register/" method="post" id="register" autocomplete="off"&gt;
  {% csrf_token %}
  &lt;div class="fieldWrapper"&gt;
    {{ form.username.errors }}
    {{ form.username.label_tag }}
    {{ form.username }}
  &lt;/div&gt;
  [... other fiels ...]
  &lt;input type="submit" value="Register"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I'm trying to connect the model with the form, so when someone register and when I type his name in the template like this : <code>{{user.name}}</code> It should be "John".</p>
  
  <p>How can I achieve this goal?</p>