Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a form for the model below. And I want a situation where if a user selects an item in the category textfield, all items in relation to that category would be loaded in the name textfied . eg. if a user selects stationary as a category, the name textfield will load data such as pen, pencil, etc which are stored in the database. Any help would be highly appreciated. Thanks

What I have tried:

Python
class Stock (models.Model):
       category = models.ForeignKey(Category, on_delete=models.CASCADE)
       name = models.CharField(max_length= 100)
       quantity = models.IntegerField(defualt=0)
       price = models.IntegerField(default = 0)
Posted
Updated 13-Apr-21 6:31am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900