imAsparky / django-tag-me

Django Tag Me... Tag a model, a field, user tags and more...
Other
1 stars 0 forks source link

[CHORE]: Add a check for existing choices in helper.py #35

Closed imAsparky closed 5 months ago

imAsparky commented 11 months ago

What is the chore?

Code located at the bottom of tag_me.utils.helpers If a TaggedCharField has a choices enum this will nuke it... I think.

def get_field_choices(
    model_verbose_name: str = None,
    field_verbose_name: str = None,
    user: User = None,
) -> list[tuple]:
    """Get the available choices for a model field.

    .. todo:: Add a check for existing field choice enum and return it.
    """

    choices = UserTag.objects.filter(
        feature=model_verbose_name,
        field=field_verbose_name,
        # user=user,
    )

    return choices