I'm looking for some help on how to get my Django project admin to work with both, treeadmin drag and drop thingy and with mptt model.
Everything worked ok out of box, but when I tried this in my admin.py:
class ItemInline(TreeAdmin):
model = MenuItems
class MenuAdmin(admin.ModelAdmin):
model = Menu
inlines = (ItemInline, )
admin.site.register(Menu, MenuAdmin)
I got an error: type object 'ItemInline' has no attribute 'fk_name'.
Now, what the heck is this fk_name and how do I add it to ItemInLine?
Here are my models as well, in case it has anything to do with anything:
class Menu(MPTTModel):
name = models.CharField(max_length = 100)
def __unicode__(self):
return self.name
class MenuItems(MPTTModel):
menu = models.ForeignKey(Menu)
name = models.CharField(max_length=50, unique=True)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
target = models.ForeignKey(Pages,null=True, blank=True)
class MPTTMeta:
order_insertion_by = ['name']
def __unicode__(self):
return self.name