-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using m2m_fields in inheritated models #1242
Comments
Hi, I made a PR(#1243) to allow declaring these fields by their name. While waiting for the new release you can subclass |
Hey @legau , many thanks for your response. However, I have trouble getting it to work. I created a very basic django project to make sure it is not an issue coming from my current code project. This file holds my models:
HistoricalRecords 2:
Now, whenever I try to save a SpecialApplication instance (inside django admin for example), I receive an error with the following stacktrace:
I attached the sample project to this comment. I would be very grateful if you could take a look at it to see whats wrong. :) |
After some tries against dsh master branch it looks like you also need #1218 which was merged 2 weeks ago |
Problem Statement
Access many-to-many fields of base model when using inheritance
Describe the solution you'd like
I have a question about using django-simple-history with models that support inheritation.
Basic example:
This results in
AttributeError: 'str' object has no attribute 'name'
I also tried using
m2m_fields=[Application.users]
but receivedAttributeError: 'ManyToManyDescriptor' object has no attribute 'name'
.How can I solve this?
Additional context
Edit: I am using Django Polymorphic for my base model, I don't know if this makes a difference, but I put it in the example.
The documentation says:
But I have no real clue how to use this. Is there an example somewhere?
The text was updated successfully, but these errors were encountered: