#6089 closed (fixed)
Remove ordering for contrib.auth User model
Reported by: | Leah Culver | Owned by: | Erik Karulf |
---|---|---|---|
Component: | Contrib apps | Version: | dev |
Severity: | Keywords: | ||
Cc: | erik@…, lau@…, spacetaxi@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In contrib.auth the User model has:
ordering = ('username',)
While it is very nice for small applications to have pretty ordered output, it's a bit hard on applications with many users (such as pownce.com). One concern is there might be applications that depend on this ordering in the User model and it would be nice not to break this functionality. However, it might be worth doing to make Django "scale"... ugh.
Attachments (2)
Change History (11)
comment:1 by , 17 years ago
Cc: | added |
---|---|
Has patch: | set |
Triage Stage: | Unreviewed → Design decision needed |
by , 17 years ago
Attachment: | unordered-auth.diff added |
---|
Removed ordering by default from User and Group
comment:2 by , 17 years ago
Triage Stage: | Design decision needed → Accepted |
---|
Accepted, with the comments I told ekarulf IRL.
by , 17 years ago
Attachment: | unordered-auth-2.diff added |
---|
Same as above with added ordering in admin
comment:3 by , 17 years ago
Cc: | added |
---|
comment:4 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Accepted → Ready for checkin |
I bumped into this again when migrating a large table of users into Django.
The patch seems fairly benign, ready for checkin?
follow-up: 6 comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 16 years ago
I have a model with a many-to-many relation to the contrib.auth User model. Now when I open the admin form (newforms-admin) to edit my model, the user-selection widget contains unsorted users... This is nearly unusable. Prior to [7806] the selection widget was sorted. I need this widget to show sorted users, but what's the right way to get them sorted again? (Maybe this is dumb question, but currently I don't see an elegant solution...)
comment:7 by , 16 years ago
Cc: | added |
---|
comment:8 by , 15 years ago
Just in case someone else has the same problem as I (and spacetaxi, as it seems) had and stumbles over this ticket: this is how I restored order (ahem) of ForeignKeys to the User model in the Admin
class MyModelForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(MyModelForm, self).__init__(*args, **kwargs) self.fields['user'].choices = [('', 10*'-')] + list(User.objects.all().values_list('id', 'username').order_by('username')) class Meta: model = MyModel class MyModelAdmin(admin.ModelAdmin): form = MyModelForm
comment:9 by , 15 years ago
Hello,
I've spent a few hours trying unsuccessfully to sort the usernames in my admin interface, posting a query on Stack Overflow which led me here:
While I think its great that piquadrat has a solution, (thanks!) can I just say "eek" and suggest that there ought to be some sane way to specify how to sort users in the admin inteface? Thanks!
I'm a strong +1 on this as well. I'll submit the small 2 line patch, though it defiantly needs a design decision.