I have two models, Order and UserProfile. Each Order has a ForeignKey to UserProfile, to associate it with that user.
On the django admin page for each Order, I'd like to display the UserProfile associated with it, for easy processing of information.
I have tried inlines:
class UserInline(admin.TabularInline): model = UserProfile class ValuationRequestAdmin(admin.ModelAdmin): list_display = ('address1', 'address2', 'town', 'date_added') list_filter = ('town', 'date_added') ordering = ('-date_updated',) 开发者_如何学JAVA inlines = [ UserInline, ]
But it complains that UserProfile "has no ForeignKey to" Order - which it doesn't, it's the other way around.
Is there a way to do what I want?
How about making the UserProfile read only? Django Foreign Keys Read Only
There are other ideas in this post also.
精彩评论