Skip to content

Conversation

@predatell
Copy link
Contributor

No description provided.

@codingjoe
Copy link
Collaborator

@predatell could you elaborate a bit more on this use case?

@codingjoe
Copy link
Collaborator

Closed: This issue has been inactive for an extended period of time. Please reopen the issue if it is still relevant.

@codingjoe codingjoe closed this Apr 5, 2019
@predatell
Copy link
Contributor Author

I want to use ModelSelect2Widget with ModelChoiceField. I set queryset to ModelChoiceField, so I don't want to add the same queryset to ModelSelect2Widget. ModelSelect2Widget can take it from self.choices.queryset. Example how do I use it:
item = forms.ModelChoiceField(queryset=MyModel.objects.filter(is_active=True), required=False, widget=ModelSelect2Widget)

@predatell predatell mentioned this pull request Apr 15, 2019
@codingjoe
Copy link
Collaborator

@predatell good idea. Can you please add test for you scenario, to make sure it works and won't break in future releases? Thanks, Joe

@codingjoe codingjoe reopened this Apr 23, 2019
@codecov-io
Copy link

codecov-io commented Apr 23, 2019

Codecov Report

Merging #509 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #509   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines           8      8           
=====================================
  Hits            8      8

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8494b10...9230c0a. Read the comment docs.

@predatell
Copy link
Contributor Author

I have removed model for ModelSelect2Widget in tests where related ModelChoiceField already has queryset. So ModelSelect2Widget takes queryset from related ModelChoiceField.

@codingjoe codingjoe merged commit 8bd7f72 into applegrew:master Jul 9, 2019
@codingjoe
Copy link
Collaborator

Released in 7.1.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants