title: how can i display extended user data on profile page django
body: <p>so i was working on extending django user model <a href="https://blog.khophi.co/extending-django-user-model-userprofile-like-a-pro/" rel="nofollow noreferrer">following this tutorial</a></p>
  
  <p>and after some trial and error i finished it but i can't seem to find a way to show the extended data on the  profile </p>
  
  <p>profile.html
      </p>
  
  <pre><code>    &lt;h2&gt; {{user.first_name}} &lt;/h2&gt;
      &lt;h2&gt;  {{user.last_name}} &lt;/h2&gt;
      &lt;h2&gt;  {{user.email} &lt;/h2&gt;
      &lt;h2&gt;  {{user.website} &lt;/h2&gt;
      &lt;h2&gt;  {{user.bio} &lt;/h2&gt;
      &lt;h2&gt;  {{user.phone} &lt;/h2&gt;
      &lt;h2&gt;  {{user.city} &lt;/h2&gt;
      &lt;h2&gt;  {{user.country} &lt;/h2&gt;
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p>view.py </p>
  
  <pre><code>@login_required() # only logged in users should access this
  def edit_user(request, pk):
      # querying the User object with pk from url
      user = User.objects.get(pk=pk)
  
      # prepopulate UserProfileForm with retrieved user values from above.
      user_form = UserForm(instance=user)
  
      # The sorcery begins from here, see explanation below
      ProfileInlineFormset = inlineformset_factory(User, UserProfile, fields=('website', 'bio', 'phone', 'city', 'country', 'organization'))
      formset = ProfileInlineFormset(instance=user)
  
      if request.user.is_authenticated() and request.user.id == user.id:
          if request.method == "POST":
              user_form = UserForm(request.POST, request.FILES, instance=user)
              formset = ProfileInlineFormset(request.POST, request.FILES, instance=user)
  
              if user_form.is_valid():
                  created_user = user_form.save(commit=False)
                  formset = ProfileInlineFormset(request.POST, request.FILES, instance=created_user)
  
                  if formset.is_valid():
                      created_user.save()
                      formset.save()
                      return HttpResponseRedirect('/accounts/profile/')
  
          return render(request, "account/account_update.html", {
              "noodle": pk,
              "noodle_form": user_form,
              "formset": formset,
          })
      else:
  
          raise PermissionDenied
  </code></pre>
  
  <p>urls</p>
  
  <pre><code>url(r'^admin/', admin.site.urls),
      url(r'^$', main_views.home, name='home'),
      url(r'^accounts/profile/$', main_views.uprofile, name='uprofile'),
      url(r'^accounts/update/(?P&lt;pk&gt;\d+)/', User_Profile_views.edit_user, name='edit_user'),
      url(r'^accounts/', include('allauth.urls')),
  </code></pre>
  
  <p>models </p>
  
  <pre><code>class UserProfile(models.Model):
      user = models.OneToOneField(User, related_name='user')
      website = models.URLField(default='', blank=True)
      bio = models.TextField(default='', blank=True)
      phone = models.CharField(max_length=20, blank=True, default='')
      city = models.CharField(max_length=100, default='', blank=True)
      country = models.CharField(max_length=100, default='', blank=True)
      organization = models.CharField(max_length=100, default='', blank=True)
  
  
  
  
  def create_profile(sender, **kwargs):
      user = kwargs["instance"]
      if kwargs["created"]:
          user_profile = UserProfile(user=user)
          user_profile.save()
  post_save.connect(create_profile, sender=User)
  </code></pre>
  
  <p>everything works fine but i can't find a way to display the extended data created in the UserProfile model</p>