The Internship Portal includes a lightweight in-app notification system that keeps both students and companies informed — without email or external services. Notifications are created automatically at two key points in the application workflow, injected into every page via a Django context processor, and displayed as an unread-count badge in the navbar. Marking them as read happens through a JavaScriptDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/unesexact/internship-portal-django/llms.txt
Use this file to discover all available pages before exploring further.
fetch call so the page never needs to reload.
Notification Model
Each notification is a single row in the database, linked to the user it is intended for. Theis_read flag controls whether the notification is still counted as unread and shown in the bell badge.
Auto-incrementing primary key.
The user this notification is addressed to. Accessible in reverse as
user.notifications.all(). Deleting the user cascades and removes all their notifications.Human-readable notification text. Max 255 characters. Generated automatically by the application views — never set manually by end users.
Whether the user has seen this notification. Defaults to
False on creation. Set to True in bulk when the user clicks the bell icon (via POST /applications/notifications/read/). Records are not deleted when read.Timestamp set automatically when the notification is created (
auto_now_add=True). Used to order notifications newest-first in the context processor.When Notifications Are Created
Notifications are generated at exactly two points in the application lifecycle, both insideapplications/views.py:
1. Student submits an application → company is notified
When apply_internship creates a new Application record, it immediately creates a notification for the company that owns the listing:
"New application received for Backend Engineer Intern"
2. Company accepts or rejects → student is notified
When update_application changes the status to accepted or rejected, it creates a notification for the student who applied:
"Your application for Backend Engineer Intern was accepted""Your application for Backend Engineer Intern was rejected"
Context Processor
Rather than querying for unread notifications in every view individually, the portal uses a Django context processor defined inusers/context_processors.py. This function is called on every request and injects two variables — notifications and notifications_count — directly into the template context, making them available in every template including the base layout.
TEMPLATES → OPTIONS → context_processors setting in settings.py:
Displaying Notifications
Unread notifications appear in a Bootstrap dropdown bell button rendered in the site-wide navbar (base.html). The bell button always shows the current unread count sourced from the notifications_count context variable. The dropdown list renders each notification’s message field, ordered newest-first because the context processor queries with .order_by("-created_at"). When there are no notifications, the dropdown shows a “No notifications” placeholder item.
Marking as Read
When the user clicks the bell button, a JavaScriptfetch call posts to POST /applications/notifications/read/. The view marks every unread notification for the current user as read in a single bulk update, then the JavaScript immediately resets the badge to zero — all without a page reload.
View:
base.html):
fetch headers, so the request passes Django’s CSRF middleware without a full page form submission.
Notifications are soft-cleared, not deleted. Marking notifications as read sets
is_read=True on each record — the rows remain in the database permanently. This means the full notification history is preserved for auditing or future features (such as a “notification history” page), even though cleared notifications no longer appear in the bell badge.