I have a <article> model that has a foreignKey to a <module> model. I want to be able to edit the <module> model within the <article> admin
in moduleApp.models I have something like:
class module(models.Model):
HTML = models.TextField( blank=True, null=True )
in articleApp.models I have something like:
class article(models.Model)
HomePageModule = models.ForeignKey(module, blank=True, null=True)
In the admin I have something:
class moduleInline(admin.TabularInline):
model = module
class ArticleAdmin(admin.ModelAdmin):
inlines = [moduleInline,]
I'm getting the error XXX has no ForeignKey to XXX.
I've found a few other people with the problem and it seems like the problem is that I need to change up the moduleInline to articleInline.
http://stackoverflow.com/questions/21899523/inline-in-django-admin-has-no-foreignkeyhttp://stackoverflow.com/questions/8526159/django-inline-has-no-foreignkey-toI'm trying to keep my moduleApp as a stand alone app and use it in multiple other apps. To achieve this I'll have to move all the admin code in the module app. This defeats my desire to make moduleApp a stand alone app.
Is there a way I can make inlines work for this? If not, what is the best way to get this done? I've got a highly customized admin so I don't mind making the edits.
Brian