Modelform not saving

Helo, i got stuck here and cant figure out exactly where the problem is coming from. The form is not saving again after i edited the widgets field

this is the form

    class ItemsForm(ModelForm):
        title = forms.CharField(widget =forms.TextInput(attrs  = {'class':'form-control',
                    'placeholder': 'Items name'}))
        price = forms.CharField(widget =forms.TextInput(attrs  = {'class':'form-control',
                    'placeholder': 'Item Price'}))
        phone = forms.CharField(widget =forms.TextInput(attrs  = {'class':'form-control',
                    'placeholder': 'Phone number'}))
        location = forms.CharField(widget =forms.TextInput(attrs  = {'class':'form-control',
                    'placeholder': 'Your location'}))
        description = forms.CharField(widget =forms.Textarea(attrs  = {'class':'form-control',
                    'placeholder': 'Enter description'}))
        thumbnails = forms.ImageField(widget =forms.FileInput(attrs  = {'class':'form-control',
                    }))
    
        
        
        class Meta:
            model =Items
            exclude = ['user',]
            # fields = ['title', 'price', 'phone', 'location', 'description', 'thumbnails']
    
    class ImageForm(ModelForm):
        image = forms.ImageField(widget =forms.FileInput(attrs  = {'class':'form-control',
                    "multiple":True}))
        
        # image = forms.FileField(
        #     label='image',
        #     widget=forms.ClearableFileInput(attrs={"multiple":True})
        # )
        class Meta:
            model =Images
            fields = ['image',]

this is the views

def itemupload(request):

  items = Items.objects.all()
  if request.method =='POST':
      
      itemsforms =ItemsForm(request.POST, request.FILES, prefix ='items')
      imageforms = ImageForm(request.POST, request.FILES, prefix = 'image')
      file= request.FILES.getlist('image')
      if all([itemsforms.is_valid(), imageforms.is_valid()]):

          item = itemsforms.save(commit = False)
          item.user = request.user
          item.save()
          

          # image =imageforms.save(commit=False)
          for i in file:
              Images.objects.create(item = item, image =i)
             

          # image.user =request.user
          # image.item = item
          # image.save()
          
          
          
          
         
          # for i in file:
          #     Images.objects.create(image=i)
            
          return redirect('index')
      return redirect('itemupload')
      
  imageforms =ImageForm()
  itemsforms = ItemsForm()
  context = {
      'imageforms': imageforms,
      'itemsform':itemsforms,
  }
  return render(request, 'jijiapp/itemform.html', context)

this is the template

  <form action="{% url 'itemupload' %}" method="post", enctype="multipart/form-data">
          {% csrf_token %}
          
          <div class = "row mb-3">
              <label class="col-md-5 col-form-label">{{ itemsform.title.label }}</label>
              <div class="col-sm-5 form-control ">
                  {{ itemsform.title }}
              </div>
              {{ itemsform.title.errors }}
          </div>
          <div class = "row mb-3">
              <label class="col-md-2 col-form-label">{{ itemsform.price.label }}</label>
              <div class="col-sm-10 form-control">
                  {{ itemsform.price }}
              </div>
              {{ itemsform.price.errors }}
              
          </div> 
          <div class = "row mb-3">
              <label class="col-md-2 col-form-label">{{ itemsform.phone.label }}</label>
              <div class="col-sm-10 form-control">
                  {{ itemsform.phone }}
              </div>
              {{ itemsform.phone.errors }}
          </div> 
          <div class = "row mb-3">
              <label class="col-md-2 col-form-label">{{ itemsform.location.label }}</label>
              <div class="col-sm-10 form-control">
                  {{ itemsform.location }}
              </div>
              {{ itemsform.location.errors }}
          </div> 
          <div class = "row mb-3">
              <label class="col-md-2 col-form-label">{{ itemsform.description.label }}</label>
              <div class="col-sm-10 form-control">
                  <div class="col-sm-10 ">
                  {{ itemsform.description }}
              </div>
              {{ itemsform.description.errors }}
          </div>
          <div class = "row mb-3">
              <label class="col-md-2 col-form-label">{{ itemsform.thumbnails.label }}</label>
              <div class="col-sm-10 form-control">
                  {{ itemsform.thumbnails }}
              </div>
              {{ itemsform.thumbnails.errors }}
          </div>
          <div class = "row mb-3">
              <label class="col-md-2 col-form-label">{{ imageforms.image.label }}</label>
              <div class="col-sm-10 form-control">
                  {{ imageforms.image }}
              </div>
              {{ imageforms.image.errors }}
          </div>      
  
  
         <button class="btn btn-secondary mb-5" >Save</button>
          
  
      </form>

this is the model

  class Items(models.Model):
      user = models.ForeignKey(User, on_delete = models.CASCADE, related_name='useritem')
      slug = models.SlugField(max_length =20, unique=True, default='slug')
      title = models.CharField(max_length=10, null=True, blank =True)
      description = models.CharField(max_length=1000, null=True, blank=True)
      price = models.CharField(max_length=20, null=True, blank=True)
      phone = models.CharField(max_length=20, null=True, blank=True)
      location =models.CharField(max_length=20, null=True, blank=True)
      post_date = models.DateTimeField(auto_now_add=True, null=True, blank=True)
      thumbnails =models.ImageField(upload_to='thumbnails/', null=True, blank=True)
  
      def __str__(self):
          return self.title
  
      class Meta:
          ordering =['-post_date',]
          verbose_name_plural ='Items'
  
  class Images(models.Model):
      # user = models.ForeignKey(User, on_delete = models.CASCADE, null=True, blank = True)
      image =models.ImageField(upload_to='media/', null=True, blank=True)
      
      item=models.ForeignKey(Items, on_delete = models.CASCADE, null=True, blank = True)
      # items = models.ManyToManyField(Items)
  
      def __str__(self):
          return str(self.item.title)
      
      class Meta:
          verbose_name_plural ='Images'

You have a number of things wrong here that need to be addressed.

First, a side note: When posting code or templates here, enclose the code (or template) between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code (or template), then another line of ```. This forces the forum software to keep your code (or template) properly formatted.
You don’t need to repost your code, you can edit your original post and put the lines of ``` before and after each file.

Because of the formatting issue, your template here isn’t complete - it’s not showing the opening form html tag. It’s also distorting the rest of the code you posted, so I can’t be sure that what I’m looking at is what you’re actually trying to run.

It would be helpful if you posted the models involved.

Since you’re creating a ModelForm, you can identify the fields in the fields attribute, along with specifying the widgets in the Meta class. You don’t need to define all the fields individually.

Anytime you’re using multiple forms in a view, you want to use the prefix attribute with those forms.

If one of the forms is invalid, you’re returning a redirect instead of rerendering the form. Because of this, you’re throwing away your error messages, making it difficult to identify any form-based errors.

Also, you’re trying to use the multiple attribute of the FileInput widget. Note that Django does not directly support multiple files in a single form widget. You would have to handle the files yourself and store them in individual model fields.

Ok Mr Ken, i have edited the post as instructed hope i get it this time. i have also added the model and prefix name for each form

You’re still not properly handling the condition where one of the forms is not valid. You don’t have a way of reporting those errors back to you.

Review the docs at: