Hi all,

Having an issue that I can't quite figure out. I've been staring at it for 
so long it's very possible I've overlooked something simple so please 
excuse me if so!

I have two models that have a relationship to `Page` - one is a typical 
`ForeignKey` (`Card`) and the other is a `OneToOneField` to add extra 
fields to the `Page` model. I am not using `EXTRA_MODEL_FIELDS`.

Conceptually it looks like this (http://dpaste.com/1P7MG0Z.txt):

          OneToOneField
  +------+       +-----------------+
  | Page |---<---| PageExtraFields |
  +------+       +-----------------+
     |
     ^ ForeignKey
     |
+------+
| Card |
+------+


I then monkey-patch in the `PageExtraFields` model as an inline like so:


from mezzanine.pages.admin import PageAdmin
PageAdmin.inlines += (PageExtraFieldsInline,)


This works fine for Page/Category objects (the inline appears and works as 
expected on the admin and the relation is accessible on each object).


But when trying to view a `Card` in the admin, I get the following exception:


Exception Type: ValueError at /admin/cards/card/13/
Exception Value: 'page_extra_fields.PageExtraFields' has no ForeignKey to 
'cards.Card'.


Full exception: http://dpaste.com/16ZY3N7.txt


Here's the weird thing: if I remove the inline, the problem goes away. So it 
can't be an issue with the model relationship, but rather how the admin is 
working.


Does anyone have an idea? Am I doing something wrong? 


I have tried the `unregister`/`register` route and subclassing PageAdmin 
instead of monkey-patching, and this has the exact same behaviour as above.


Thanks



-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to