Package: tri.query
Warningtri.query is end of life. It has been merged intoiommi.iommi is backwards incompatible but the porting effort should be fairly mild,
the biggest changes are thatshowis now calledinclude,Variableis renamed
toFilterand plural is used consistently for containers (sovariable__fooisfilters__fooin iommi).tri.querytri.query makes it easy to implement searching and filtering in your Django app.Major features:Generate simple filtering GUIs easily while at the same time:Supply your views with advanced query languagesQuery language can be used stand alone without the GUI partsHighly customizable GUI based ontri.formExampleSimple view that allows the user to search for a car by choosing the make from a drop down, and search
for specific model in the advanced mode:classCarQuery(Query):make=Variable.choice(choices=['Toyota','Volvo','Ford'],form_field__show=True)# Display this field in the simple style GUImodel=Variable.text()defcars(request):query=CarQuery()cars_query_set=query.request_to_q(request)form=query.form()returnrender(template_name='cars.html',context_instance=RequestContext(request,{'query_form':form,'cars':cars_query_set}))<!-- cars.html -->{% include "tri_query/form.html" with form=query_form %}<ul>{% for car in cars %}<li>{{ car }}</li>{% endfor %}</ul>After switching to the advanced mode:Programmatically call the search API:query=CarQuery()cars_query_set=query.parse('make=Toyota and (make=1991 or make=1992)')Running testsYou need tox installed then justmake test.LicenseBSDDocumentationhttp://triquery.readthedocs.orgChangelog6.4.0 (2020-04-24)Upped dependency tri.declarative to 5.x6.3.0 (2020-03-09)Better error reporting when doing freetext search when there are no freetext fields6.2.0 (2020-01-09)Variablewas missing the@with_metadecoratorChange python version to 3.76.1.0 (2019-10-14)Bumped dependency for tri.declarativeBumped dependency for tri.form6.0.0 (2019-06-14)Renamed module fromtri.querytotri_queryDropped support for python 2 and django < 2.05.0.2 (2019-05-03)Fixed cases where from_model lost the type when inheriting5.0.1 (2019-04-25)Fixedmulti_choice_querysetwhen selecting multiple items and also filtering on some other field at the same time.5.0.0 (2019-04-12)MakeVariableshortcuts compatible with subclassingUse the new major tri.declarative, and update to follow the new style of class member shortcutsAdded missingVariable.multi_choiceshortcut4.2.1 (2019-04-25)Fixedmulti_choice_querysetwhen selecting multiple items and also filtering on some other field at the same time.4.2.0 (2019-04-01)Make Variable shortcuts compatible with subclassing4.1.0 (2019-02-18)http endpoint for query validation errors:query/errors4.0.4 (2018-10-23)Support searching for quotation mark4.0.3 (2018-10-10)A more helpful error message if you didn’t specifyvalue_to_q_lookupbut you need to.Removed buggy use ofsetdefaults. This could cause overriding of nested arguments to not take.4.0.2 (2018-10-04)AddedVariable.boolean_tristatefor editing boolean fields with null value allowed4.0.1 (2018-09-21)Made Query aRefinableObject4.0.0 (2017-08-22)Moved to tri.declarative 0.34 and tri.form 5.0Note thatgui__classto specify a constructor/callable is no longer a valid parameter, because of updated tri.form. Usegui__call_targetor justgui.You no longer need to specify themodelparameter tochoice_querysetormulti_choice_querysetif you give it aQuerySetaschoices(as opposed to giving a callable)3.3.0 (2017-04-27)Move default behaviors out from the shortcuts so they can be used externallyRemoved jquery dependency for toggling simple/advanced filteringRemoved support for Django 1.73.2.0 (2017-03-22)Variableclass now inherits fromobject, making the implementation more pythonic.
(Attributes still possible to override in constructor call, seeNamespaceAwareObject)3.1.0 (2016-09-19)Moved to the simplified factory system forfrom_modelAdded shortcuts toVariable: url, time, datetime, date, email, decimal3.0.0 (2016-09-14)Updated to latest major tri.form2.2.0 (2016-08-16)Variable.choice_queryset handles the string “null” the same way as everything elseQueries that have multi-select inputs now work2.1.1 (2016-08-08)Report invalid operators for choice queryset as errors instead of crashing2.1.0 (2016-07-12)Check for dates that are out of range2.0.0 (2016-06-02)Cache form on QueryRender global form errorsQuery.form() no longer takes a request parameter, since it was redundant anyway. This is a potential breaking change.Correctly dispatch attr to underlying tri.formSupport for ajax backend. New parameter to Query: endpoint_dispatch_prefix.1.11.0 (2016-04-25)Minor bugfix for variable-from-model handling of auto fields1.10.0 (2016-04-21)Fix over-eager assert not allowing variable-less Query objects.1.9.0 (2016-04-21)Enable mixing variable definitions in both declared variables and class meta.Addedafterattribute onVariableto enable custom variable ordering (Seetri.declarative.sort_after())Added Variable.from_model, Query.from_model1.8.0 (2016-04-19)Added robustness in when arguments are passed asdict(foo=dict(bar=17))orfoo__bar=171.7.0 (2016-04-08)Add python 3 support1.6.0 (2016-03-03)Variable.floatshortcut addedAdd support for Django 1.7 and 1.8.