"Add New" to foreign key field in django modelform

Viewed 2540

I'm pretty new to this, apologies if i'm unclear....

running django, with bootstrap, and i've been fiddling with django-bootstrap. BootstrapModelForm is pretty cool, i didn't include the django-bootstrap stuff in my example, but i though i should note.

I have models:

class spam(models.Model):
   name = models.CharField()

class Eggs(models.Model):
   spam = models.ForiegnKey('spam')

I use a modelform,something like:

class EggsForm(forms.ModelForm):
   meta:
      model=Eggs

EggsForm allows selection of which spam will be referenced by eggs. I noticed the admin interface has a cool way to either select or add another egg.

How can i get similar functionality into my create form?

3 Answers
Related