1π
If you only need 3-4 sets of form widgets to display all necessary query forms for the 300+ categories, you should use Django forms to specify the widgets. You do not need 300+ Django forms for that as you can easily use multiple forms in one page.
As a quick example, your
<fieldset>
<legend>Price</legend>
<label for="price_from">from</label>
<input type="text" name="price_from">
<label for="price_to">to</label>
<input type="text" name="price_to">
</fieldset>
would become
class PriceForm(forms.Form):
price_from = forms.IntegerField()
price_to = forms.IntegerField()
β¦and of course the template to embed the form into which would provide the <fieldset>
and other necessary html document structure.
EDIT:
As it seems that your form labels etc. depend on the category, you still need to have some information about the forms in the category documents in mongodb. However, by using django forms you get a lot of useful functionality for free, such as input validation.
You probably can parametrize the templates in such a way that you give the category-specific values (labels etc.) to the template from mongodb, along with the necessary forms.
1π
Technique for constructing dynamic filtered (faceted) search with Map/Reduce: http://ianwarshak.posterous.com/faceted-search-with-mongodb
I have successfully migrated the code to Python (and used it in a Django project).
- [Answered ]-Django Textfield maximum size to be displayed
- [Answered ]-Django: Display attributes of Person model
- [Answered ]-How do I setup virtualenv on a production Windows server using IIS and Helicon Zoo?
- [Answered ]-How can i test django rest framework class based views
- [Answered ]-Use logged in username as field value in django