OK, I think I've answered my own question, though I'll need to test
it.
Instead of overriding FooModelForm's __init__(), I'd just create
create a FooModelForm with "FooModelForm (initial = {'bar':
some_bar})". I also detected some naming errors since my last post.
On Dec 12, 11:03 am, Aaron wrot
Say I have this model:
model Foo(models.Model):
bar = models.ForeignKey(Baz)
I have a ModelForm for Foo (FooModelForm). However, instead of having
a ModelChoiceField for bar, I want a single bar object in a hidden
field that's specified when creating the FooModelForm.
my_bar = Baz.objects.ge
2 matches
Mail list logo