Implement student profile completion and block PG/PhD registration - #1950
Merged
vikrantwiz02 merged 2 commits intoAug 13, 2026
Merged
Conversation
- profile_completed flag on Student/Phd batch-upload models (migration 0050) - /api/auth/me returns must_complete_profile (incomplete batch-upload record) - student/profile_completion GET (frozen + prefilled editable fields) and submit endpoints; server-side validation: required set, Aadhaar 12 digits, at least one parent mobile, student mobile != parent, blood-group Other -> remarks; photo/signature base64 (png/jpg, size caps) with old-file cleanup; sets profile_completed on success - 10 regression tests
Add a block_pg_phd decorator (403 for PG/PhD) and apply it to the 24 student-facing views behind the pre-registration, final-registration, Swayam and add/drop/replace tabs, which are hidden from PG/PhD in the UI. Mirrors the existing _is_phd_student classification used by the frontend.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a middleware decorator to restrict certain academic procedures API endpoints to undergraduate students only, blocking access for PG/PhD students. It also adds a mechanism to enforce profile completion for students on their first login, and exposes new endpoints for student profile completion. These changes enhance access control and ensure data integrity for student records.
Access Control and Restrictions:
block_pg_phddecorator inviews.pyto return a 403 error for PG/PhD students attempting to access undergraduate-only academic procedures. This decorator is applied to over 20 student-facing API endpoints, such as course registration, Swayam registration, and course drop/add requests, ensuring these flows are only accessible to eligible undergraduate students. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24]Student Profile Completion Enforcement:
auth_viewinglobals/api/views.pyto check if a student (UG or PhD) has an incomplete profile (from batch upload) and require them to complete their profile before using the app. This is communicated to the frontend via a newmust_complete_profilefield in the API response.API Endpoints for Profile Completion:
programme_curriculum/api/urls.pyfor student profile completion views, enabling students to access and submit their profile completion forms via/student/profile_completion/and/student/profile_completion/submit/. [1] [2]