The Workshop Model, is ready and enaging for users to register for a workshop. Some Images of the previously conducted workshops, can also be displayed. This would allow them to view how previous workshops were organized successfully.
For this, we would create a model to store the images. We shall do it in the event/models.py
file.
class WorkshopGallery(models.Model):
image = models.ImageField(upload_to='workshop_gallery/')
description = models.TextField()
department = models.ForeignKey(Department, on_delete=models.CASCADE)
This model stores a image, its description which is optional, and the department which organized it.
To create a table, migrations need to be applied.
python manage.py makemigrations
python manage.py migrate
This would create a table in the database.
In the next section, we would see how to register this model in the admin page.