Skip to content

Commit 2b97592

Browse files
committed
Now the app supports nicknames with spaces without 504 error
1 parent 990dc92 commit 2b97592

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

django_messages/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
from django_messages.models import Message
1515
from django_messages.forms import ComposeForm
1616
from django_messages.utils import format_quote, get_user_model, get_username_field
17+
try:
18+
from urllib import unquote
19+
except ImportError:
20+
from urllib.parse import unquote
1721

1822
User = get_user_model()
1923

@@ -95,6 +99,7 @@ def compose(request, recipient=None, form_class=ComposeForm,
9599
else:
96100
form = form_class(initial={"subject": request.GET.get("subject", "")})
97101
if recipient is not None:
102+
recipient = unquote(recipient)
98103
recipients = [u for u in User.objects.filter(**{'%s__in' % get_username_field(): [r.strip() for r in recipient.split('+')]})]
99104
form.fields['recipient'].initial = recipients
100105
return render(request, template_name, {

0 commit comments

Comments
 (0)