Skip to content

bug(thesis): null=True on CharField/TextField creates dual empty representations #316

Description

@thejoeejoee

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.pyregistration_number, abstract
  • django/apps/attachment/models/attachment.pyfile_path

Fix

Remove null=True from these string fields and add a data migration to convert existing NULL values to ''.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingimpact: mediumMedium impact — correctness or performance issuepythonPull requests that update Python code

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions