As the model, is created we can register the model in the admin page. After doing that, we would be able to view the registrations done on the website.
In the event/admin.py file :
from .models import Workshop, AbstractEvent, WorkshopInstructor, Contact, WorkshopGallery, Workshopregistration
@admin.register(Workshopregistration)
class WorkshopRegistrationAdmin(admin.ModelAdmin):
list_display = ('workshop', 'student', 'registered_date')
search_fields = ('workshop__name', 'student__email')
list_filter = ('registered_date', 'workshop')
autocomplete_fields = ('workshop', 'student')
def get_queryset(self, request):
qs = super().get_queryset(request)
if not request.user.is_superuser:
qs=qs.filter(workshop__department = request.user.hodprofile.department)
return qs
After doing this, it would be visible on the website along with the filters. In the next section, we would see how we can make the users register through the website.