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. Thanks.
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) https://stackoverflow.com/questions/67067113/preloading-data-in-a-textfield-based-on-another-textfield April 13, 2021 at 08:07AM
没有评论:
发表评论