django-cms / djangocms-versioning

General purpose versioning package for Django CMS 4 and above.
Other
33 stars 29 forks source link

fix: Adds compatibility for User models with no username field [#292] #293

Closed marksweb closed 1 year ago

marksweb commented 2 years ago

Description

I use a User model which has no username, therefore get_queryset() fails because there's no username attribute on the User.

This allows a project to specify what field on User can be used to identify a user.

This doesn't include proper testing, but to test this properly it needs a custom model, a corresponding model manager that can create users without a username. I'm hesitant to add these to the project, so if anybody has any suggestions on how to test against this I'd love to hear them.

Related resources

Checklist

codecov[bot] commented 2 years ago

Codecov Report

Merging #293 (9734e58) into master (4e5b1c4) will increase coverage by 1.74%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
+ Coverage   85.17%   86.91%   +1.74%     
==========================================
  Files          24       30       +6     
  Lines         931     1743     +812     
  Branches      141      269     +128     
==========================================
+ Hits          793     1515     +722     
- Misses        108      173      +65     
- Partials       30       55      +25     
Impacted Files Coverage Δ
djangocms_versioning/admin.py 88.76% <100.00%> (ø)
djangocms_versioning/conf.py 100.00% <100.00%> (ø)
djangocms_versioning/forms.py 100.00% <0.00%> (ø)
djangocms_versioning/cms_config.py 81.21% <0.00%> (ø)
djangocms_versioning/__init__.py 100.00% <0.00%> (ø)
djangocms_versioning/models.py 94.85% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.