I want to be able to place an inline between two different fields in a set of fields. You can already do this with foreignkeys, I figured that nesting the class I wanted and defining it to get additional forms would do the trick, but apparently I get: "class x" doesn't have a ForeignKey for "class y "
mistake. Isn't that what is supported in Django 1.0? If so, how can I solve the problem if there is no existing solution?
in models.py
class Place(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=80) class Owner(models.Model): name = models.CharField(max_length=100) place = models.ForeignKey(Place) background = models.TextField() license_expiration = models.DateTimeField('license expiration')
in admin.py
class PlaceInline(admin.TabularInline): model = Place extra = 5 class OwnerAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['background','place', 'license_expiration']}), ] inlines = [PlaceInline]
python django django-admin
Ardesco
source share