title: How can I find the current users primary key to check if it matches a notes pk?
body: <p>I am working on an application that stores data on different artists, venues, and notes the user can create for shows. I am currently trying to implement a feature to delete an existing note based off it's PK and the users PK associated with that note. I have most the work done but I don't know how they are storing the current logged in users PK to check before deleting.</p>
  <p>Here is what I have so far and links for reference:</p>
  <p><a href="https://github.com/claraj/lmn/blob/master/lmn/views/views_notes.py" rel="nofollow noreferrer">https://github.com/claraj/lmn/blob/master/lmn/views/views_notes.py</a></p>
  <pre><code># Note related paths
  path('notes/latest/', views_notes.latest_notes, name='latest_notes'),
  path('notes/detail/&lt;int:note_pk&gt;/', views_notes.note_detail, name='note_detail'),
  path('notes/for_show/&lt;int:show_pk&gt;/', views_notes.notes_for_show, name='notes_for_show'),
  path('notes/add/&lt;int:show_pk&gt;/', views_notes.new_note, name='new_note'),
  path('notes/detail/&lt;int:show_pk&gt;/delete', views_notes.delete_note, name='delete_note'),
  </code></pre>
  <p><a href="https://github.com/claraj/lmn/blob/master/lmn/urls.py" rel="nofollow noreferrer">https://github.com/claraj/lmn/blob/master/lmn/urls.py</a></p>
  <pre><code># Delete note for show
  @login_required
  def delete_note(request, show_pk): 
  
  # I need to grab the existing note PK and user PK associated with that note
  # Then check if the current user matches the PK associated with that note to delete or return a 403 status code.
  if note.user == request.user:
      note.delete()
      return redirect('latest_notes')
  else:
      return HttpResponseForbidden
  </code></pre>
  <p><a href="https://github.com/claraj/lmn/blob/master/lmn/templates/lmn/notes/note_list.html" rel="nofollow noreferrer">https://github.com/claraj/lmn/blob/master/lmn/templates/lmn/notes/note_list.html</a></p>
  <pre><code># Grabs PK for specific note
  &lt;form action=&quot;{% url 'delete_note' note.pk %}&quot; method=&quot;POST&quot;&gt;
      {% csrf_token %}
      &lt;button type=&quot;submit&quot; class=&quot;delete&quot;&gt;Delete&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>