Skip to content
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

Fix Admin on Django 5.2 #608

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

pfouque
Copy link
Member

@pfouque pfouque commented Jan 27, 2025

Early testing the upgrade to Django 5.2, I'm facing an issue with Django-constance admin:

  File "/home/runner/work/silvr-app/silvr-app/silvr-app/.venv/lib/python3.12/site-packages/constance/admin.py", line 194, in <module>
    admin.site.register([Config], ConstanceAdmin)
  File "/home/runner/work/silvr-app/silvr-app/silvr-app/.venv/lib/python3.12/site-packages/django/contrib/admin/sites.py", line 116, in register
    if model._meta.is_composite_pk:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Meta' object has no attribute 'is_composite_pk'

Indeed, Django last/next version provides composite primary keys which requires a new Meta on Models.
Due to the fake Config model django Constance is using, we need to do likes for other properties and hardcode it on the Config.

@pfouque pfouque requested a review from Natim January 27, 2025 08:45
@pfouque pfouque self-assigned this Jan 27, 2025
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.69%. Comparing base (1451943) to head (062ccf7).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #608      +/-   ##
==========================================
+ Coverage   84.23%   84.69%   +0.45%     
==========================================
  Files          21       21              
  Lines         736      745       +9     
  Branches      117      121       +4     
==========================================
+ Hits          620      631      +11     
+ Misses         83       82       -1     
+ Partials       33       32       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Mogost Mogost merged commit 2ae381e into jazzband:master Jan 27, 2025
12 checks passed
@pfouque
Copy link
Member Author

pfouque commented Jan 27, 2025

Thanks @Natim and @Mogost !

@Mogost
Copy link
Member

Mogost commented Jan 27, 2025

Released in 4.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants