Thursday, 15 May 2014

django - Query database using POST data in FormView class -


I am very new in Django and need help with a simple task. I have two templates.

  1. search.html : Provides a simple form with a text field, a submit button and a post / search_results /
  2. search_results.html : / search_results /

is the result of the database query posted to my Forms.py in the file: django import forms from class system forms (forms.Form): serial_num = form.CharField (label = "serial no.", Max_length = 45) < P> urlpatterns = pattern ('', url (r '^ search / $', SystemSearch.as_view ()), Url (r '^ search_results / $') in my urls.py

, SystemResult.as_view ()),)

Import from the Django.views.generic.edit import list from my view.py file

Import the FormView SystemForm class SystemSearch (FormView) from: #Form template_name = 'inventory / search Form_class = SystemsForm clas S SystemResult (FormView) to show '.html': template_name = 'inventory / search_result.html' form_class = SystemsForm # How to do these two things? # Databases model models are called systems with POST data # - System.Objects.Gate (Serial_NU = ??) #Search_Stilt Reference to Passport

I'm not even sure That's what I'm going in the right direction or what I should do entirely.

No comments:

Post a Comment