title: Editing the model object with update view django by excluding fields
body: <p>I am trying to <code>Edit/Update</code> a model object(record) using django <code>Updateview</code></p>
  
  <p><strong>model.py</strong></p>
  
  <pre><code>from django.db import models
  from myapp.models import Author
  
  class Book(models.Model):
      author = models.ForeignKey(Author)
      book_name = models.CharField(max_length=260)
      amount = models.DecimalField(
          max_digits=10, decimal_places=2, default=0.00)
  
      description = models.TextField()
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class BookEditView(generic.UpdateView):
      model = Book
      template_name_suffix = '_update_form'
      exclude = ('author',)
  
      def get_success_url(self):
          return reverse("books:list_of_books")
  </code></pre>
  
  <p><strong>books_update_from.html</strong></p>
  
  <pre><code>{% extends "base.html" %}
  {% block main_title %}Edit Book{% endblock %}
  {% block content %}
    &lt;form method="post" action="" class="form-horizontal"&gt;
       {{form.as_p}}
    &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>When the form is rendered, the <code>Author</code> foreign field is still displaying on the page even though i had mentioned it in <code>exclude</code> in <code>BookEditview</code> as  above</p>
  
  <p>So how to hide that field and submit the form ?</p>
  
  <p>Also i tried by rendering individual fields like <code>form.book_name</code>, <code>form.amount</code> etc.,(I know this approach does n't solve the above issue but just given a foolish try). when i submit the form, its action is negligable and does nothing because we are not submitting the <code>author foreign key value</code> and hence the form is invalid and submit does n't do anything</p>
  
  <p>So what i want to know is how to exclude the field from the model when rendering it as a form using <code>UpdateView</code> to edit the model(Am i done something wrong above in my code ?)</p>
  
  <p>Also i want know the concept of <code>Updateview</code> that if we exclude the <code>foreignKey</code> field then there is no need to submit the foreign Key value ?(Because the Edit form will be valid only if every field including the <code>Author Foreign Key</code> is submitted with value ? )</p>