Thanks to visit codestin.com
Credit goes to github.com

Skip to content

proposal: remove *StatusChoices and AttributeType models #843

@simonLeary42

Description

@simonLeary42

The experience for a new Coldfront admin could be improved if they didn't have to grapple with confusingly named models in the admin interface which expose unnecessary internals.

Examples:

What's the difference between Allocation > attribute types and Allocation > allocation attribute types again? Right, Allocation > attribute types is a table of strings that name other data types like "Date", where Allocation > allocation attribute types contains the actual attributes such as Storage Quota (GB).

Why can't I find Pending in the dropdown list of allocation states (#811)? Well, in contrast to the dozens of scattered lists of status names across the codebase (#816), that particular list is actually in SQL. Each status name is actually an instance of a model called AllocationStatusChoice which is basically just a wrapper for a string .name. We fetch those records like this: AllocationStatusChoice.objects.filter(name__in=...) (examples). That table is managed by migrations, but the migrations aren't generated automatically by django like normal, we make them by hand. A migration has actually already been created to add Pending (43f9c4b), it just doesn't work.

Instead of keeping models / objects for *StatusChoices and AttributeType, I propose that we use Django enums.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions