Not displaying all the files I uploaded. Showing only one

I uploaded multiple files into my database. All file were uploaded and saved in database. But In front-end or even in django admin site. It is displaying only one file. I checked the database all the files what I have selected are uploaded but not showing all the files in front-end or django-admin site.

How to display all the files which are uploaded into my database in django?

We’ll need to see the models, forms, views, and ModelAdmin class for this.

def create_course_save(request):
    if request.method == 'POST':
        courseCode = request.POST.get('course_code')
        courseName = request.POST.get('course_name')
        courseShortInfo = request.POST.get('course_short_info')
        courseWYWL = request.POST.get('course_wywl')
        courseSYWG = request.POST.get('course_sywg')
        courseDesc = request.POST.get('course_desc')
        courseCC = request.POST.get('course_coordinator')
        courseCC = User.objects.get(id=courseCC)
        courseBranch = request.POST.get('branch')
        courseSemester = request.POST.get('semester')
        courseSemester = Semester.objects.get(id=courseSemester)
        courseFiles = request.FILES.getlist('course_files')
            for file in courseFiles:
                courseObj = Course.objects.create(
        except Exception as e:
        return redirect('manage_courses')

class Course(models.Model):
        ("","Branch Name"),
        ("Computer Science and Engineering","Computer Science and Engineering"),
        ("Aerospace/aeronautical Engineering","Aerospace/aeronautical Engineering"),
        ("Chemical Engineering","Chemical Engineering"),
        ("Civil Engineering","Civil Engineering"),
        ("Electronics and Communications Engineering","Electronics and Communications Engineering"),
        ("Electrical and Electronics Engineering","Electrical and Electronics Engineering"),
        ("Petroleum Engineering","Petroleum Engineering"),
        ("Bio Technology","Bio Technology"),
        ("Mechanical Engineering","Mechanical Engineering"),
    id = models.UUIDField(primary_key = True, unique = True, default = uuid.uuid4, editable = False)
    course_code = models.CharField(max_length = 100, unique = True)
    course_name = models.CharField(max_length = 100, unique = True)
    course_short_info = models.TextField(max_length = 500, default="Start your path to a career in project management. No degree or experience is required.")
    course_wywl = models.TextField(max_length = 500, default="WHAT YOU WILL LEARN")
    course_sywg = models.TextField(max_length = 500, default="SKILLS YOU WILL GAIN")
    course_desc = models.TextField(max_length = 500, default="Description of the Course")
    course_coordinator = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
    branch = models.CharField(max_length = 50, choices = BRANCH_CHOICES, default=1)
    semester = models.ForeignKey(Semester, on_delete=models.SET_NULL, blank=True, null=True)
    course_files = models.FileField(upload_to='Course Files/', blank=True, null=True)

    def __str__(self):
        return '%s - %s' % (self.course_code, self.course_name)

from django.contrib import admin
from .models import (Course)

Front-end (HTML)

    <label for="Upload Files">Upload Files</label>
    <input type="file" name="course_files" id="id_course_files" multiple>
    <input type="submit">

And I didn’t used forms

My requirement is to save the multiple files in one object. Is it possible? And What I observed is only one file is being saved in the databse for that object.

Each Field only stores a reference to one file.

Yes, an instance of a Model can store references to multiple files - if each file is assigned to a different Field.

And you really will save yourself a lot of work by using a form.

Could you share the code to it, Please or any reference to it. So, I can do it myself

Code to what? I don’t understand what you’re asking for.