title: Django - Form Not Updating
body: <p>I’m creating a profile page in my web application &amp; I have a form to when the  user makes a form submission I need the data from the form to update in admin from the current logged in user.</p>
  
  <p>The data populates in the admin however new listings keep repeating every time the user submits a form. I need the the data to update only. Screenshot attached.</p>
  
  <p>How do I execute this correctly with my current code? </p>
  
  <p>The Custom User Model I’m using is located in <code>from users.models import CustomUser</code> if that helps.</p>
  
  <p>Any help i gladly appreciated, Cheers</p>
  
  <p><a href="https://i.stack.imgur.com/SgO7P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SgO7P.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/H6kVS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H6kVS.png" alt="enter image description here"></a></p>
  
  <h1>user_profile/models</h1>
  
  <pre><code>from django.contrib import auth
  from django.db import models
  from django.urls import reverse
  from django.contrib.auth.models import AbstractUser, UserManager
  from django.contrib.auth.models import BaseUserManager
  from django.contrib.auth.models import User
  from django.db.models.signals import post_save
  from django.dispatch import receiver
  from django.conf import settings
  from users.forms import CustomUserCreationForm, CustomUserChangeForm
  from users.models import CustomUser
  
  class Listing (models.Model):
  
      image = models.ImageField(default='default.jpg', upload_to='profile_pics')
      user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)
      created =  models.DateTimeField(auto_now_add=True, null=True)
      updated = models.DateTimeField(auto_now=True)
      name = models.CharField(max_length=100)
      address = models.CharField(max_length=100)
      zip_code = models.CharField(max_length=100)
      mobile_number = models.CharField(max_length=100)
  #    cc_number = models.CharField(max_length=100)
  #    cc_expiration = models.CharField(max_length=100)
  #    cc_cvv = models.CharField(max_length=100)
  #    objects = ListingManager()
  
  def create_profile(sender, **kwargs):
      if kwargs['created']:
          user_profile = Listing.objects.create(user=kwargs['instance'])
  
  post_save.connect(create_profile, sender=CustomUser)
  </code></pre>
  
  <h1>user_profile/views.py</h1>
  
  <pre><code>def change_view(request):
      form = HomeForm(request.POST or None, request.FILES or None)
      user_profile = Listing.objects.all
      user = request.user
      if request.method == "POST":  # checking if request is POST or Not
          # if its a post request, then its checking if the form is valid or not
          if form.is_valid():
              listing_instance = form.save(commit=False)  # "this will return the 'Listing' instance"
              listing_instance.user = user # assign 'user' instance
              listing_instance.save() # calling 'save()' method of model
              return redirect("myaccount")
  
      context = {
          'form': form, 'user_profile': user_profile 
      }
  
      return render(request, "myaccount.html", context)
  </code></pre>
  
  <h1>user_profile/admin.py</h1>
  
  <pre><code>from django.contrib import admin
  from django.contrib.auth import get_user_model
  from django.contrib.auth.admin import UserAdmin
  
  
  from user_profile.forms import HomeForm
  from users.forms import CustomUserCreationForm, CustomUserChangeForm
  
  from user_profile.models import Listing
  from users.models import CustomUser
  
  
  # Register models here.
  class UserProfileAdmin(admin.ModelAdmin):
      list_display = ['name', 'address', 'zip_code', 'mobile_number', 'created', 'updated', 'user']
      list_filter = ['name', 'zip_code', 'created', 'updated', 'user']
  
  admin.site.register(Listing, UserProfileAdmin)
  </code></pre>
  
  <p><strong>html</strong></p>
  
  <pre><code>{% block content %}
  &lt;form role="form" action="" method="post" enctype="multipart/form-data"&gt;
  {% csrf_token %}
  {{ form.errors }}   
  {{ form.name }}
  {{ form.address }}
  {{ form.zip_code }}
  {{ form.mobile_number }}
  {{ form.image }}
  &lt;button class="btn btn-primary btn-success btn-round btn-extend" type="submit" value="Submit"&gt;&lt;i class="zmdi zmdi-favorite-outline6"&gt;&lt;/i&gt;Submit&lt;/button&gt;
  &lt;/form&gt;    
  {% endblock content %}
  </code></pre>
  
  <h1>user_profile/urls.py</h1>
  
  <pre><code>from django.conf.urls import url
  from . import views
  from django.urls import path, include
  from django.conf import settings
  
  from .views import change_view
  
  urlpatterns = [
      path('myaccount/', change_view, name='myaccount'),
  ]
  </code></pre>
  
  <p><strong>settings</strong></p>
  
  <pre><code>AUTH_USER_MODEL = 'users.CustomUser'
  </code></pre>