Customize the search form

55 views
Skip to first unread message

LeVon Smoker

unread,
Jul 31, 2018, 2:17:45 PM7/31/18
to Mayan EDMS
Is there a good way to do this to...
- change the field labels
- add a custom search widget (autocomplete)

As always, I don't want to hack the original source code...

Thanks.

Roberto Rosario

unread,
Aug 8, 2018, 5:11:44 PM8/8/18
to Mayan EDMS
Autocomplete is possible but will require a new API to return the top result values so that a smart widget like Select2 could display them. Possible but requires code changes. 

What do you mean by "change the field labels"? Can you expand on this? This one might be simpler to implement.

LeVon Smoker

unread,
Aug 9, 2018, 2:51:06 PM8/9/18
to Mayan EDMS
Using a custom app, I overrode (is that a word?) the appearance/home.html template to point at my own url on the Advanced button ({% url 'my_overrides:search_advanced' search_model='documents.Document' %}). From there it was creating custom versions of AdvancedSearchForm, AdvancedSearchView, and ResultsView to get what I wanted. My version of AdvancedSearchForm adds a ModelMultipleChoiceField which provides an autocomplete way to find specific documents.

In my AdvancedSearchForm, I was able to change the label on a field - Label - to Name (users were confused - "where's the document name?")

Roberto Rosario

unread,
Aug 20, 2018, 12:28:57 AM8/20/18
to Mayan EDMS
"I overrode (is that a word?)" I'm not a native speaker, my guess is as good as yours :D

Thanks for sharing your customization. I'll see if we can add some of your changes so you don't have to rewrite all from scratch on the next update.
Reply all
Reply to author
Forward
0 new messages