[PATCH 24/51] filters: Rewrite the submitter autocompletion code
damien.lespiau at intel.com
Thu Sep 10 02:12:12 AEST 2015
On Wed, Sep 09, 2015 at 04:07:32PM +0100, Finucane, Stephen wrote:
> > We now have a nice(r) autocompletion widget that will popup the list of
> > options directly underneath the input fild. A few changes are done in
> > this commit that couldn't be split any further:
> > - Use jQuery's $.ajax() for the completion query
> > - Use the application/json content type on the completion answer to
> > allow jQuery to directly create an object from it instead of giving
> > back a string (because of the text/plain content type)
> > - Crafted more logical objects in the json answer ie all properties are
> > at the same level instead of the default queryset serializer that put
> > the object fields in a 'field' sub-object.
> > - Use selectize.js for the autocompletion widget logic
> > A slight change in behaviour is that we now don't allow "free form"
> > submitter search, ie we need a valid completion to search with that
> > specific person (through its primary key). I didn't remove the backend
> > logic that allows the "free form" mechanism, but maybe we should.
> > v2: Squash the unit tests fixes into this patch (Jeremy Kerr)
> > Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
> Parts of this are so similar to my change it's scary: we clearly read the same Django docs.
> What happens if a submitter doesn't have a name, though? This is
> possible as 'Person.name' has the 'null' and 'blank' attributes set to
> 'True'. In my case, I had to use the id as I couldn't be sure the name
> would be present.
In that case, we autocomplete on the email address only.
More information about the Patchwork