title: Django - How to pull a logged in users data from a database table?
body: <p>I am relatively new to Django, and web development in general. Basically, I want to pull a logged in users data from a database table so he can view/edit it on a 'My profile' page.</p>
  
  <p>I'm guessing the best way to do this would be to call the logged in users 'id', then somehow use it to call the row in the database table I want?</p>
  
  <p>This is how far I have got, but I don't want the user's 'id' in the url, I want the users 'row id' in the database table:</p>
  
  <p>urls.py</p>
  
  <pre><code>    url(r'^my-profile/(?P&lt;id&gt;[0-9]+)', my_profile, name="my_profile"),
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>    user = request.user
  </code></pre>
  
  <p>template</p>
  
  <pre><code>    &lt;a href="{% url 'my_profile' id=user.id %}"&gt;My profile&lt;/a&gt;
  </code></pre>
  
  <p>Any help would be much appreciated!</p>
  
  <p>My current code:</p>
  
  <p>models.py</p>
  
  <pre><code>    class BarSignUp(models.Model):
  
          LOCATION_CHOICES=(
              ("Central London", "Central London"),
              ("North London", "North London"),
              ("East London", "East London"),
              ("South London", "South London"),
              ("West London", "West London"),
          )
  
          user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
          name = models.CharField(max_length=50)
          bio = models.CharField(max_length=50)
          area = models.CharField(max_length=50, choices=LOCATION_CHOICES, null=True)
          booking_link = models.CharField(max_length=100, null=True)
          timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
  
          def __str__(self):
              return self.email
  
          def get_absolute_url(self):
              return reverse("barber_profile", kwargs={"id": self.id})
  </code></pre>