ajenhl / eats

EATS is a web application for recording, editing, using and displaying authority information about entities.
GNU General Public License v3.0
7 stars 3 forks source link

'Related entity' auto-complete field should show preferred name, not most recently added name #24

Closed philgooch closed 11 years ago

philgooch commented 11 years ago

When typing into the 'Related entity' field when adding or editing an entity relationship, for a given entity the most recently added name type is displayed, rather than the preferred name (if ticked).

I think it would be helpful if the preferred name was shown. E.g. if you wanted to create an entity relationship to an entity that had 'Smith, Joan' as its preferred name type, and this entity had another maiden name type of say 'Jones, Joan', which had been added later, you'd want 'Smith, Joan' to appear in the auto-complete field, not 'Jones, Joan'.

philgooch commented 11 years ago

Adding the following lines to def get_item_label (self, item): in lines 24-26 in eats/lookups.py seems to work here, but please confirm if this is the best approach:

        preferred_name = item.get_preferred_name(None, None, None)
        if (preferred_name):
            name_assertion = preferred_name
philgooch commented 11 years ago

Actually this only partially fixes the problem :( Preferred names are displayed in the auto-complete, but on selecting that name, the text reverts to the most recently added name type for that entity.

Any pointers appreciated :)

philgooch commented 11 years ago

Doh!, just needed to make the same change to get_item_value(). Works fine now.