Changes between Initial Version and Version 1 of Ticket #37088


Ignore:
Timestamp:
May 7, 2026, 7:35:21 AM (4 weeks ago)
Author:
Natalia Bidart
Comment:

Thank you Johannes, this makes sense. Though implementation wise, I would rather each class defines their own __eq__ isolating the specific semantic instead of defining a class attribute.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37088

    • Property Keywords Media MediaAsset added
    • Property Triage Stage UnreviewedAccepted
  • Ticket #37088 – Description

    initial v1  
    11This is a spin-off from here: https://github.com/django/django/pull/21239#issuecomment-4396168812
    22
    3 Currently MediaAsset.__eq__ compares only the path.
     3Currently `MediaAsset.__eq__` compares only the path.
    44
    55This approach was deliberately chosen to benefit performance.
    66
    77However, in the case of `link`-elements and even `script` this approach can break.
    8 For a link, `rel=stylesheet` and `rel=refretch` can share the same path. Prefetching is also not too crazy a use case; someone will probably try to do it.
     8For a link, `rel=stylesheet` and `rel=prefetch` can share the same path. Prefetching is also not too crazy a use case; someone will probably try to do it.
    99
    1010A compromise could be to define an explicit list of attributes to compare, instead of doing a full dictionary comparison via `attributres`.
Back to Top