custom query app

21 views
Skip to first unread message

John Schmitt

unread,
Nov 13, 2014, 7:34:33 PM11/13/14
to django...@googlegroups.com
I have a big django project with multiple apps, models, and the models have quite a few fields.

A request came that asked for a page that allows the user to pick and choose from the various fields to create their own query.

Does any precedent for this exist?

If I may use a car analogy, a django project that stores info on cars complete with many types of engines, car models, interiors, entertainment systems, and trim features. Could I create an app where a user could arbitrarily pick and choose fields from each of those models to perform a query on their web browser? One customer could search for cars with V8 engines and DVD players and a different customer could search for cars with nylon interiors, no entertainment systems and manufactured between dateA and dateB. The key thing is that the customer gets to browse for the available attricutes and add them to their query.

The most obvious would be create an app that fixed every possible field and appropriate form for each field. When a model changes and a new field is added, simply add another field to this query app. This is what real estate sites seem to do. I'd like to think there's a more general and elegant way to do this. Is there a general purpose field chooser?

At first I thought that this project would be a good starting point, because he kind of implements spreadsheet:

https://github.com/tmu/dimtable

I'm not sure how I can map my problem to that potential solution.

Discussion and wild-eyed ideas welcome.

John

Clifford Ilkay

unread,
Nov 13, 2014, 8:08:45 PM11/13/14
to django...@googlegroups.com
On 11/13/2014 02:33 PM, John Schmitt wrote:
> I have a big django project with multiple apps, models, and the models have quite a few fields.
>
> A request came that asked for a page that allows the user to pick and choose from the various fields to create their own query.
>
> Does any precedent for this exist?

Hi John,

What you're looking for is called "faceted search" or "faceted
navigation". Django Haystack
<http://django-haystack.readthedocs.org/en/latest/> is one
implementation of this.

--
Regards,

Clifford Ilkay

C. Kirby

unread,
Nov 13, 2014, 9:07:04 PM11/13/14
to django...@googlegroups.com
Hi John,
I built an app that basically lets you create an advanced search against a model (or related models).
I am using it in production on two different applications. If you use it I would be happy to have feedback.

You can find it here:
https://github.com/ckirby/django-modelqueryform

Kirby

John Schmitt

unread,
Nov 14, 2014, 9:54:26 PM11/14/14
to django...@googlegroups.com
Thanks for the help. With those terms I found http://en.wikipedia.org/wiki/Faceted_search so that I can find help online.

This looks interesting, but it might be abandoned:

https://bitbucket.org/magicrebirth/djfacet

John
Reply all
Reply to author
Forward
0 new messages