Django Form Foreignkey Database Field Not As Dropdown
I have a database model like, with a ForeignKey field. From this model I created a form with class Foobar(models.Model): foobar = models.ForeignKey(Foobar) bar = models.Ch
Solution 1:
Are you looking for this?
from django import forms
class FoobarForm():
class Meta:
model = Foobar
def __init__(self, *args, **kwargs):
super(FoobarForm, self).__init__(*args, **kwargs)
self.fields['foobar'].widget = forms.TextInput()
Post a Comment for "Django Form Foreignkey Database Field Not As Dropdown"