Refactor magic recipients field when sending new message.

Uses local cache of user mappings instead of AJAX calls; has just enough
customization hooks to allow for a department/user mapping for MJ...
This commit is contained in:
Lance Edgar 2016-02-11 17:05:56 -06:00
parent ad9cd8be8e
commit c65bc6f229
3 changed files with 86 additions and 66 deletions

View file

@ -63,6 +63,9 @@ class AutocompleteView(View):
"""
return instance.uuid
def get_data(self, term):
return self.query(term).all()
def __call__(self):
"""
View implementation.
@ -73,5 +76,5 @@ class AutocompleteView(View):
term = self.prepare_term(term)
if not term:
return []
results = self.query(term).all()
results = self.get_data(term)
return [{'label': self.display(x), 'value': self.value(x)} for x in results]