Skip to content

Implement Model-Level Validation for Course Entity #1041

@aditii23

Description

@aditii23

Currently, the Course model in web/models.py allows saving records with empty titles, missing descriptions, or no images. This leads to data integrity issues and results in "Blank" or broken cards appearing on the frontend UI.

Problem:
The fields in the Course model likely have blank=True or null=True set, or they lack explicit validation. This allows the database to accept incomplete entries, which degrades the user experience.

Proposed Changes:
Strict Field Constraints: Update web/models.py to ensure title, description, and image fields do not allow null or blank values.
Data Validation: Ensure that even if someone tries to save a course via the Django Admin or a script, it triggers a ValidationError if required fields are missing.
Migration: Generate and apply migrations to reflect these constraints in the database schema.

Affected Files:
web/models.py

Expected Behavior:
The system should reject any Course entry that does not have a valid Title, Description, and Image.

The database remains clean and consistent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions