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

Issue with user models which don't have a username #292

Closed
marksweb opened this issue Sep 9, 2022 · 1 comment
Closed

Issue with user models which don't have a username #292

marksweb opened this issue Sep 9, 2022 · 1 comment

Comments

@marksweb
Copy link
Member

marksweb commented Sep 9, 2022

We've got a queryset in ExtendedVersionAdminMixin which expects the User to have a username, but I've got a User model that uses email to login and doesn't include a username field.

def get_queryset(self, request):
        queryset = super().get_queryset(request)
        # Due to django admin ordering using unicode, to alphabetically order regardless of case, we must
        # annotate the queryset, with the usernames all lower case, and then order based on that!
        queryset = queryset.annotate(created_by_username_ordering=Lower("versions__created_by__username"))
        return queryset

https://github.com/django-cms/djangocms-versioning/blob/master/djangocms_versioning/admin.py#L136

So this is throwing an error from djangocms-alias

marksweb added a commit to marksweb/djangocms-versioning that referenced this issue Sep 24, 2022
fsbraun added a commit that referenced this issue Dec 9, 2022
…#293)

* fix: Compatibility with User models which have no `username` field. #292
* Update changelog

Co-authored-by: Fabian Braun <[email protected]>
@fsbraun
Copy link
Member

fsbraun commented Jan 10, 2023

Fixed by #293

@fsbraun fsbraun closed this as completed Jan 10, 2023
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

No branches or pull requests

2 participants