title: Django: How to use modal as a form to update an object
body: <p>I'm trying to use modal as a edit form but I don't know good way.</p>
  
  <p>Currently my <code>views.py</code> is like this.</p>
  
  <pre><code>def edit_entry(request, entry_pk):
  
      entry = get_object_or_404(Entry, pk=entry_pk)
  
      if request.method != 'POST':
          form = EntryForm(instance=entry, user=request.user)
      else:
         form = EntryForm(instance=entry, data=request.POST, user=request.user)
  
          if form.is_valid():
              form.save()
  </code></pre>
  
  <p>and I have a template for this view.</p>
  
  <p>What I want to do is
  from the page that lists a bunch of entry objects, the edit form for the object is shown when I click edit button.</p>
  
  <pre><code>{% for entry in entries %}
      ...
      &lt;button class="btn btn-outline-primary" data-toggle="modal" data-target="#editEntryModal"&gt;Edit&lt;/button&gt;
  
      &lt;!-- modal for the object --&gt;
  </code></pre>
  
  <p>Anyone who could give me tips?</p>