Django

College Event Registration Website

CampusConnect Introduction and Setup Configuring settings file for template, static and media files Setting up Tailwind Creating Custom User Model Creating Super User for CampusConnect Registering Custom User Model Search and Filter for User Model Serving Media Files During Development Categorizing Departments Linking Department with HOD Creating Abstract Model for Event Creating Model for Workshop Customizing Admin Page for Workshop Update in Model AbstractEvent Adding Instructor for Workshop Instructor Model Admin Page Adding Poster Field in Abstract Event Providing Access to HOD Access Update for HOD Restricting HOD Access to Particular Department AbstractEvent On Spot Registration Field Creating Workshop Object Creating and Linking Home Page Displaying Workshop on Home Page Styling Home Page Adding Workshop Detail Page Link Workshop Detail Page Workshop Detail Page Styling Workshop Instructor Details Workshop Detail Contact Contact Admin Page Many to Many Field for Contact Displaying Contact on Workshop Detail Page Adding Title for Workshop Detail Page Adding Gallery for Workshop Workshop Gallery Admin Page Displaying Gallery Images on Website Through Context Displaying Gallery Images on Website through template tags Authentication for users User Registration User Registration Submission Logout Functionality For User Login Functionality for User Model For Workshop Registration Workshop Registration Admin Page Register Workshop Function Register Button in Workshop Page Validations Before Workshop Registration Workshop Registration Closed Validaiton User Already Registered for Workshop Validation Workshop Registration Report From Admin Page Export using Library in Django Admin Extending Abstract Event for Hackathons

Workshop Detail Contact

For Workshops being conducted, there some contact details need to be added so that students can contact them, in case they have some queries regarding their workshops. For this, we can create a new model to store the contact details.

We shall create a model inside event/models.py, This time we shall go with a many to many field for storing contact information instead of a foreign key and see how it can be used. So for that first lets create a model to store information for it.

class Contact(models.Model):
    name = models.CharField(max_length=255)
    number = models.CharField(max_length=20, unique=True)
    designation = models.CharField(max_length=1, choices=[('s', "Student Coordinator"),
                                                          ('f', "Faculty Coordinator")])
    
    def __str__(self):
        return f"{self.name} - {self.designation}"

This model, stores the name, number, department and designation of the person whose contact information is to be displayed. This is a general model and it can be used here and also in other events such as Symposiums, Conferences, Hackathons and much more that are to be added in the website.

To create a table in the database, you will need to run the migrations. alt text After this is done, it can be viewed in the admin page by registering the model in event/admin.py

from .models import Workshop, AbstractEvent, WorkshopInstructor, Contact
admin.site.register(Contact)

alt text The contact model will be visible on the admin page after this, in the next section we will make changes in the admin page of the contact model as done with the previous models.