Here is my model:
class Directory(models.Model):
name = models.CharField(max_length=60)
class Business(Directory):
anyfield = models.CharField(max_length=60)
class Gallery(models.Model):
directory = models.ForeignKey(Directory),
pic = models.ImageField(upload_to='pics')
This is admin.py
class Galleries(admin.TabularInline):
model = Gallery
class DirectoryAdmin(admin.ModelAdmin):
inlines = [
Galleries,
]
admin.site.register(Business,DirectoryAdmin)
This is the error I get in admin.
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/town/business/add/
Exception Type: Exception
Exception Value:
<class 'towns.town.models.Gallery'> has no ForeignKey to <class
'towns.town.models.Business'>
If I take out the inlines bit in admin.py and just have
admin.site.register(Business)
admin.site.register(Gallery)
Then it works as expected.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---