简体   繁体   中英

Create a input box on a app using django

I am tasked with a project of creating an app with python. We have decided to use django for this purpose. Basically, I need to create an app where users can go on to a website, type their names, addresses and get the required information about their historical product purchase.

Now, I am using mariadb in python to query the names. The function I created successfully gets the users name using some name matching algorithm and gets their required information. If the user misspells his/her name, the program also outputs suggested names that match what the user implied. Hence, if the user clicks on his/her name, he will get all historical purchase history for that user.

I managed to use django to create a basic website. But, I want to create input boxes where users can put in their info. Do I actually go to models.py in django and create a names model? Also, is an administrative site required for this purpose?

Edit: from further reading, it seems I need to use inspectdb and tell django to automatically create models for me?

You may get all the information you need from the Django tutorial in the docs. The first three chapters talk about the initial setup for the database and administration site.

https://docs.djangoproject.com/en/2.0/intro/tutorial01/

The fourth one handles the the creation of forms:

https://docs.djangoproject.com/en/2.0/intro/tutorial04/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM