v1.0a1 AttributeError on changes_display_dict for ManyToOne relation
See original GitHub issueWhen accessing the property changes_display_dict
on a LogEntry with a ManyToOneRelation, I get the following error:
(running with Django 3.1 and Python 3.8.5, and version 1.0a1 of auditlog.)
AttributeError Traceback (most recent call last)
<ipython-input-3-77e970a5d758> in <module>
1 for h in history:
----> 2 print(h.changes_display_dict)
3
~/.virtualenvs/dashboard/lib/python3.8/site-packages/auditlog/models.py in changes_display_dict(self)
259 # handle choices fields and Postgres ArrayField to get human readable version
260 choices_dict = None
--> 261 if getattr(field, 'choices') and len(field.choices) > 0:
262 choices_dict = dict(field.choices)
263 if hasattr(field, 'base_field') and isinstance(field.base_field, Field) and getattr(field.base_field, 'choices') and len(field.base_field.choices) > 0:
AttributeError: 'ManyToOneRel' object has no attribute 'choices'
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
python - AttributeError: 'dict' object has no attribute 'predictors'
when I changed all instances of "item(s)" in the code to "predictor(s)". Why is that so? # Return the Pearson correlation coefficient for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nanuxbe I closed it because it wasn’t supposed to be opened with the master branch. So right now there’s also a lot of other commits not relevant to the pull request. It seems like a lot of people are experiencing this issue, so I’ll open a new pull request with a proper branch and hopefully see it being merged sometime.
There’s nothing preventing this merge, as it has no impact on the code whatsoever, other than preventing a possible error.
I opened a new pull request #317
@tudoanh Could you please give me a small example that reproduces the problem?