Description
In django/apps/thesis/models/thesis.py, registration_number (CharField) and abstract (TextField) use null=True, and in django/apps/attachment/models/attachment.py, file_path (CharField) also uses null=True.
This creates two possible representations of "empty" in the database: None and '' (empty string). Django's convention for string-based fields is to use blank=True only and store empty values as '', avoiding the ambiguity.
Severity
Medium — data inconsistency, requires OR filters to check for empty values.
Location
django/apps/thesis/models/thesis.py — registration_number, abstract
django/apps/attachment/models/attachment.py — file_path
Fix
Remove null=True from these string fields and add a data migration to convert existing NULL values to ''.
Description
In
django/apps/thesis/models/thesis.py,registration_number(CharField) andabstract(TextField) usenull=True, and indjango/apps/attachment/models/attachment.py,file_path(CharField) also usesnull=True.This creates two possible representations of "empty" in the database:
Noneand''(empty string). Django's convention for string-based fields is to useblank=Trueonly and store empty values as'', avoiding the ambiguity.Severity
Medium — data inconsistency, requires
ORfilters to check for empty values.Location
django/apps/thesis/models/thesis.py—registration_number,abstractdjango/apps/attachment/models/attachment.py—file_pathFix
Remove
null=Truefrom these string fields and add a data migration to convert existingNULLvalues to''.