pinax / pinax-messages

a Django app for allowing users of your site to send messages to each other
MIT License
202 stars 58 forks source link

fix queryset on new message forms #39

Closed volksman closed 6 years ago

paltman commented 6 years ago

Maybe something changed in Django versions since i last used this app. Its been awhile.

Sent from my iPhone

On Nov 15, 2017, at 7:31 AM, volksman notifications@github.com wrote:

@volksman commented on this pull request.

In pinax/messages/forms.py:

@@ -21,7 +21,7 @@ def label_from_instance(self, obj): class NewMessageForm(forms.ModelForm):

 subject = forms.CharField()
  • to_user = UserModelChoiceField(queryset=get_user_model().objects.none)
  • to_user = UserModelChoiceField(queryset=get_user_model().objects.none()) It was producing an error in my build that was preventing the message_create view from being displayed. I narrowed it down to the form creation and specifically the queryset. I'm not sure how else you'd propose to fix this but I'm all ears.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

grahamu commented 6 years ago

@paltman ModelChoiceField requires a queryset parameter, this has been true since Django v1.7 or earlier. The previous default:

get_user_model().objects.none

is a function, not a QuerySet, and rightly fails tests.