Opened 7 years ago

Last modified 7 years ago

#28347 new New feature

Adding custom attributes to django model field — at Version 1

Reported by: Tom Turner Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tom Turner)

I want to add a custom attributes to a Django model field

name = models.CharField(max_length=255, data_merge=True)

I want to do this so i can loop round my fields and see if this field is set.

        for field in Project._meta.get_fields(include_parents=False, include_hidden=False):
            if field.extra_info.data_merge:
                   // do something here

I haven't been the first to ask for this see https://stackoverflow.com/questions/20679057/adding-custom-attributes-to-django-model-field

If you accept this enhancement I am happy to write a patch, test and documentation. Please let me know.

Change History (1)

comment:1 by Tom Turner, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top