How To Avoid This Dropdown Combo Box?
I've created modelform of playlist and items like this: class playlistmodel(models.Model): user = models.ForeignKey(User) title = models.CharField(max_length=200) def _
Solution 1:
Perhaps you need to explicitly include or exclude what fields you want displayed to the user.
You'll then have to manually update the parts of the object that you excluded before you save the object to the database. Take a look at the commit=False
argument to the ModelForm.save()
method as described in the documentation.
For example, your code might look something like this:
if form.is_valid():
obj = form.save(commit=False)
obj.user = request.user
obj.save()
Post a Comment for "How To Avoid This Dropdown Combo Box?"