I am new to Django and creating a dropdown menu so that users can choose a category from the dropdown. This category will be saved on an entry on the website, when a user creates a new entry. I migrated the model, but I'm getting: KeyError at /auctions/create
'category.' Any help is really appreciated.
Views.py (Code for creating the dropdown menu for categories)
models.py
forms.py
Here is the create part in views.py for creating a new entry. 'form' for CreateForm() is the model form for creating the entry. 'form1' for CategoryForm() is the model form for the category drop down list. The create function was working completely fine, until I added in the parts for the categories and category form.
urls.py for applicable functions (I have tried many variations for the category one but I'm still having trouble figuring out what it should be, I have tried str and int.)
Sorry I'm a beginner but any help would be great!
path("auctions/create", views.create, name="create"),
path("listings/<int:id>", views.listingpage, name="listingpage"),
path("cat/<int:id>", views.cat, name="cat"),
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…