title: How can I upload multiple files in to a Django model?
body: <p>I'm trying to make an LMS system with Django and now I need to upload multiple pdf files to the curriculum of the class. I can upload one file with the <code>OnetoOne</code> field in the Django model but not more. When I try to add another material for the same class it says <code>Upload materials with this Uploaded class already exists.</code> This is my model code.</p>
  <pre><code>class UploadMaterials(models.Model):
      name = models.CharField(max_length=255)
      uploaded_class = models.OneToOneField(Class, on_delete=models.CASCADE, related_name='upload_materials')
      upload_material = models.FileField(upload_to=rename, null=True)
  
      class Meta:
          verbose_name_plural = &quot;Materials&quot;
  </code></pre>
  <p>I need to upload the materials and be able to view them in the template. like......</p>
  <pre><code>{% for material in class.materials %}
  &lt;h1&gt;{{ material.name }}&lt;/h1&gt;
  {% endfor %}
  </code></pre>
  <p>I tried the Django <code>ForeignKey</code> instead of <code>OnetoOne</code> and was able to create multiple materials for the same class
  but could not figure out how to access them from the template.</p>
  <p>What I want to know is how to upload multiple files to the same class and how to access them in the template.</p>
  <p>Thank you!</p>