Home > other >  Django framework for implementing mongo query data and returns a web page
Django framework for implementing mongo query data and returns a web page

Time:05-20

Now that I've written the mongo display data, deleting data, add data backend code and front-end code, need to write a according to the conditions of the query function, such as data fields is the company's name, phone,, I want to by region query, then put the whole data (company, name, telephone, area) are displayed, the following is I checked on the net:
Def find (request) :
Region=request. POST. Get (" region ", None)
Message=None
All_message=invitation. Objects (region=region)
If all_message:
Message=all_message [0]

Return render (request, 'find. HTML, message)

Here is the HTML code:
Please enter the region (only supported by search) : & lt; Input type="text" name="company" style="width: 500 px" placeholder="please enter the region" & gt;







{% for item in invitation %}



{% endfor %}

The company & lt;/th>
Contact & lt;/th>
Telephone & lt;/th>
Address & lt;/th>
Scope of business & lt;/th>
Legal person & lt;/th>
Type & lt;/th>
Set up a time & lt;/th>
The registered capital & lt;/th>
The number of employees & lt;/th>
The url & lt;/th>
Regional & lt;/th>
Source & lt;/th>
Company introduction & lt;/th>
Industry & lt;/th>
Pany} {{item.com} & lt;/td>
{{item. Contacts}} & lt;/td>
{{item. Telephone}} & lt;/td>
{{item. The address}} & lt;/td>
{{item. The product}} & lt;/td>
{{item. The person}} & lt;/td>
{{item. Type}} & lt;/td>
{{item. Time}} & lt;/td>
{{item. Capital}} & lt;/td>
{{item. Number}} & lt;/td>
{{item. Web}} & lt;/td>
{{item. Region}} & lt;/td>
{{item. Source}} & lt;/td>
{{item. Introduce}} & lt;/td>
{{item. Industry}} & lt;/a>
  • Related