Changes between Version 1 and Version 2 of Ticket #20267, comment 2
- Timestamp:
- Apr 16, 2013, 2:22:09 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #20267, comment 2
v1 v2 11 11 12 12 13 Now there were actually two problems. The first one was with withthe initial value for crag_type. Filtering should be done by GET requests, I believe, so I simply did this in my view:13 Now there were actually two problems. The first one was with the initial value for crag_type. Filtering should be done by GET requests, I believe, so I simply did this in my view: 14 14 15 15 {{{ … … 41 41 which I don't like at all but it was the simplest solution. 42 42 43 But I have work on and discovered yet another problem with order_by and order_asc fields. These fields are not part of the frontend form (by graphic design and provided templates) but it seemed natural to put them into the backend/logic form anyway so that I can simply pass these parameters to model with others and then in models differentiate what to put as param of .filter() and what to put as a param of .order_by(). This approach simply makes view simpler (which is good, I think). Backend form does not "match" the frontend form but it was possible to do it like this without any javascript hacks and it all worked well. Except initial values because checking if request.GET is empty before passing it to the filter was no longer working. Basically, if querystring has not been populated, submitting the form trashed initial values for filter params and submitting the ordering trashed initial values filtering. In the end I needed to do something like this in view:43 But I have worked on and discovered yet another problem with order_by and order_asc fields. These fields are not part of the frontend form (by graphic design and provided templates) but it seemed natural to put them into the backend/logic form anyway so that I can simply pass these parameters to model with others and then in models differentiate what to put as param of .filter() and what to put as a param of .order_by(). This approach simply makes view simpler (which is good, I think). Backend form does not "match" the frontend form but it was possible to do it like this without any javascript hacks and it all worked well. Except initial values because checking if request.GET is empty before passing it to the filter was no longer working. Basically, if querystring has not been populated, submitting the form trashed initial values for filter params and submitting the ordering trashed initial values filtering. In the end I needed to do something like this in view: 44 44 45 45 {{{