Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Limit selects#3313

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lovelydinosaur merged 4 commits intomasterfromlimit-selects
Aug 21, 2015
Merged

Limit selects#3313

lovelydinosaur merged 4 commits intomasterfromlimit-selects
Aug 21, 2015

Conversation

@lovelydinosaur
Copy link
Contributor

Closes#3309.

lovelydinosaur added a commit that referenced this pull requestAug 21, 2015
Limit rendering of relational selects to max 1000 items by default.
@lovelydinosaurlovelydinosaur merged commitf601c6c intomasterAug 21, 2015
@lovelydinosaurlovelydinosaur deleted the limit-selects branchAugust 21, 2015 10:41
@rubendura
Copy link
Contributor

Is this really working as it should? I've got a PrimaryKeyRelatedField and the html_cutoff parameter is being ignored (using either the default value or a smaller one).
That relation spans thousands of rows, so that page is impossible to load. Setting the style as suggested in the docs to input.html does the trick, but the dropdown is still unusable.
I tried setting the cutoff to 20 just to test it and I can't see any change, it took forever.

@lovelydinosaur
Copy link
ContributorAuthor

@rubendura Just gave it a try myself for sanity and I'm not seeing any problems with it - working just fine. You've updated to 3.2.3 right?

@rubendura
Copy link
Contributor

Yes, DRF is updated to 3.2.3

On 25 Aug 2015, at 14:36, Tom Christienotifications@github.com wrote:

@rubendurahttps://github.com/rubendura Just gave it a try myself for sanity and I'm not seeing any problems with it - working just fine. You've updated to 3.2.3 right?


Reply to this email directly or view it on GitHub#3313 (comment).

@lovelydinosaur
Copy link
ContributorAuthor

I really can't replicate this...

git clone https://github.com/tomchristie/basic-rest-framework.git examplecd examplevirtualenv envsource env/bin/activatepip install -r ./requirements.txtpython manage.py migratepython manage.py shell> from django.contrib.auth.models import Group> for i in range(10000):>     Group.objects.create(name='Group%d' % i)> exitpython manage.py runserver

image

Given that I can't reproduce the issue you're seeing I'd need you to narrow this down to a simple replicable case.

@rubendura
Copy link
Contributor

I think I've found the root of my issue.
RelatedField.choices seems to ignore html_cutoff when building the returned OrderedDict. My queryset at that point contains ~400k items. I'm running my test system inside a vagrant machine and it looks like while performing this operation I run out of memory in that machine, thus the slowness. Actually the process is being killed after some time with no response.
Is it possible to limit the number of items being used inside RelatedField.choices? Maybe slice the queryset using html_cutoff before creating the OrderedDict.

@lovelydinosaur
Copy link
ContributorAuthor

Okay that makes sense - could you open this as a new issue 'Improve relation choices limiting' or similar? If you could also point toexactly where it's failing that'd be helpful. Thanks so much!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

3.2.3 Release

Development

Successfully merging this pull request may close these issues.

3 participants

@lovelydinosaur@rubendura

[8]ページ先頭

©2009-2025 Movatter.jp