python - In Django, searching and filter by searchbox and categories in one go? -


I wonder if you can help me.

I have a list of data that will be displayed on a page A simple search box is a list of categories and a list of tags that can be used to filter the list of all data. I'm trying to prepare it from the ground (so it does not require javascript) but eventually it will submit the search criteria and will return a new list with the help of Ajax.

So I have a list of categories in my database ('big', 'small', etc.), and I have a list of tags in my database ('wood', 'bronze'). Tags are used to filter for more than the categories. I have a search box. Ideally, I want the user to effectively mark the categories they want, what tags they want and possibly search for keywords, and then submit all those data. So that it can be inquired and returned a new list of filtered data.

I'm not a Django expert, and I'm stuck on how to do this ... and how to get the categories out of categories as a checkbox list, what's the demo, the checkbox list and the one The search box with the submit button ... which I submitted, can I take all that data and do the necessary questions on the database? I can not understand how I do this ... I have been looking at Django docs and Django for a few days and the way I am doing does not seem to be listed.

Please, any help on everyone will be fantastic.

Spit out categories as a checkbox list,

one Tag as checkbox list and

search box with a submit button ...

This is a & lt; Forms & gt; In its HTML page it probably does not match anything well in the Django model. This is a unique form created more or less manually.

Can I take all that data and do the necessary questions on the database?

This is a visible function.

You probably have something like this.

  objects = SomeModel.objects If the request is received ... the categories are ... objects = objects ... failers (... categories ...) if requested. Gate ... are tagged in ... objects = objects ... .filter (... tag ...) if request.GET ... is searched ... objects = objects.filter (some_contents (search) ) Return_to_proportion (... etc ...)  

Return paths

You are out of the tutorial.

What to do?

  1. Do all the tutorials the whole path. Not every step seems like it solves your problem, but you have to do a complete tutorial.

  2. Design your model You did not mention the model in question. This is absolutely the most important and original thing.

  3. Create the default Admin interface for that model Get the default working method to work and do the things you want to do, it has great search, category and tag filtering. .

    In order for the default administrator to work, you will need to design a very sophisticated model and form features. You probably have to add the method functions along with your model as well as the choice of items and other well-being.

  4. If you have an administrator page that you want, you can write your own customized view.


Each single checkbox has a different name ('category_option_1', 'category_option_2', etc.) ... How do I read this? I just can not request POST ['category_option_n']?

Really? For the name in

(1024): Request to create = a `q` object
. Use POST.get (name, none).

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -