Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
Step 3 : Filtering¶
In this step we will add end-user filtering using simple parameter fields.
The data window with our products now has a new button in its toolbar. Clicking on this button toggles an additional panel, the parameter panel, to expand or collapse.
We add a new database model “Category”
We add some database fields (delivery_unit, price)
We add more demo data so that there is something to filter
To activate the code of this step in your contributor environment:
$ go lets
$ git checkout step3
To see what we changed since the previous step:
$ git diff step2
Not many explanations here yet. Try to understand the code changes and ask questions.
Some hints:
Note that the Offers, Demands and Products tables now have a icon in their toolbar. This is the main new feature. Play with it.
The
delivery_unit
field is a choicelist field. This is similar to aForeignKey
, but instead of pointing to a database row, it points to a choice in a hard-coded table, which we call a choicelist. See Introduction to choicelists.The
Model.get_simple_parameters
method (a class method on a database model) yields the name of database fields to be used as “table parameters”, i.e. the fields that appear in the “parameter panel” (the panel that expands and collapses when you hit the button). See Introduction to actor parameters.