diff messages/forms.py @ 1138:0e93eaa323e7

Fix user autocomplete for private messages the right V3 way.
author Brian Neal <bgneal@gmail.com>
date Sun, 23 Oct 2016 12:17:03 -0500
parents 6abcecd3d277
children
line wrap: on
line diff
--- a/messages/forms.py	Sun Oct 23 12:00:04 2016 -0500
+++ b/messages/forms.py	Sun Oct 23 12:17:03 2016 -0500
@@ -27,7 +27,7 @@
     """
     receiver = forms.CharField(label='To',
             max_length=30,
-            widget=forms.TextInput(attrs={'class': 'sg101-user-autocomplete'}))
+            widget=forms.TextInput(attrs={'class': 'sg101-autocomplete'}))
     subject = forms.CharField(max_length=120)
     message = forms.CharField(widget=forms.Textarea)
     attach_signature = forms.BooleanField(label='Attach Signature?', required=False)
@@ -38,6 +38,8 @@
         self.user = user
         options = Options.objects.for_user(user)
         self.fields['attach_signature'].initial = options.attach_signature
+        url = reverse('core-ajax_users')
+        self.fields['receiver'].widget.attrs['data-autocomplete-url'] = url
 
     def clean_receiver(self):
         receiver = self.cleaned_data['receiver']