[Grok-dev] Multiple Model Issue

Low Kian Seong zope.low at gmail.com
Sat Nov 1 01:42:02 EDT 2008


Just a question, is the equivalent of foreignkeys in zodb?

On Sat, Nov 1, 2008 at 3:09 AM, Tim Cook <timothywayne.cook at gmail.com> wrote:
> Hi All,
>
> Having read all I can find about multiple models in one application I
> have an issue I cannot solve.
>
> In a fairly stock grokproject; let's say that in app.py I have:
>
> ---------------------------------------------
> import grok
>
> from q.w.e import B  # class B inherits from grok.Model
>
> class A(grok.Application,grok.Container):
>   pass
>
> class Index(grok.View):
>   pass
>
>
> class BIndex(grok.View):
>   grok.context(B)
>   grok.template('bindex')  # though this should be automatic?
> ---------------------------------------------
>
> In the app_templates folder I have:
>
> index.pt and bindex.pt
>
> the url http://localhost:8080/a  works as expected.
>
> the url http://localhost:8080/a/bindex gives me a Zope error:
> The page that you are trying to access is not available
>
> I get no erros on server startup and in fact at one point I added a
> render method to BIndex and sure enough I got the expected error during
> startup. So the template is associated correctly.  Also if I go
> introspection it says that the template bindex is associated with the
> class B.
>
> So just how do you associate different templates with models inside the
> same application?
>
> Thanks,
> Tim
>
>
>
> --
> Timothy Cook, MSc
> Health Informatics Research & Development Services
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> Skype ID == timothy.cook
> **************************************************************
> *You may get my Public GPG key from  popular keyservers or   *
> *from this link http://timothywayne.cook.googlepages.com/home*
> **************************************************************
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
>


More information about the Grok-dev mailing list