Changes between Initial Version and Version 1 of Ticket #35224


Ignore:
Timestamp:
Feb 16, 2024, 4:31:54 PM (10 months ago)
Author:
Adam Johnson
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35224 – Description

    initial v1  
    11When introduced in bca5327b21eb2e3ee18292cbe532d6d0071201d8, GenericForeignKey was created as its own class. Since then, it has grown to resemble a field, particularly in fb48eb05816b1ac87d58696cdfe48be18c901f16.
    22
    3 GenericForeignKey *not* being a `Field` is confusing. It is added as a “field” and returned by `Model._meta.get_fields()`, a type confusion [https://github.com/typeddjango/django-stubs/blob/5a8e7b3855ea6f7be2b2ab928d02eff9a748d917/django-stubs/db/models/options.pyi#L122-L124 reflected in django-stubs]. It also duplicates code from `Field`.
     3GenericForeignKey *not* being a `Field` leads to several issues:
     41. It is added as a “field” and returned by `Model._meta.get_fields()`, a type confusion [https://github.com/typeddjango/django-stubs/blob/5a8e7b3855ea6f7be2b2ab928d02eff9a748d917/django-stubs/db/models/options.pyi#L122-L124 reflected in django-stubs].
     52. It duplicates code, such as `_check_field_name()`.
     63. It misses methods like `__repr__()`.
    47
    58I think we should make it a subclass of `Field`.
Back to Top