Skip to content

Inconsistencies with field access regarding m2m fields #1186

Open
@mjsir911

Description

Hi,

Describe the bug
We've been working with historical records assuming that they can be transparently swapped with underlying instances and used in the same context.

To Reproduce

obj = Document()
histobj = obj.history.latest() # should be able to be used equivalently?

obj.name == histobj.name # normal fields act the same
obj.attachments.all() == histobj.attachments.all() # m2m fields do not, historical m2m fields resolve out to the through field

Expected behavior
I expect the m2m field to work the same as it does within django, resolving the through field connection and returning an object associated with the other side of the connection (not sure if this can be a historical object?)

Environment (please complete the following information):

  • Django Simple History Version: master: 5128890
  • Django Version: 4.2.2
  • Database Version: sqlite 3.41.2

Additional context
Add any other context about the problem here.

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