Application Integration

14 views
Skip to first unread message

Nico C.

unread,
May 4, 2011, 7:26:46 AM5/4/11
to django-page-cms
Hi !

Has anyone used app integration ? I add the call to register_urlconf
in my « master app » urls.py. Registration does seem to work as the
following lines:

from pages.urlconf_registry import register_urlconf, registry as
pages_urlconf_registry
register_urlconf(_noop('My App'), 'pagecms.myapp.urls',
label=_('Display App'))
print pages_urlconf_registry

do produce the following output in the server log :
[('My App', 'pagescms.myapp.urls', 'Display App', 'pages.myapp.urls')]

Yet nothing changes in the pages admin site, or maybe I'm blind.
Where « the delegate to list with a 'Display App' item in it » is
supposed to appear exactly ? I imagined near the redirect to input,
looked every where.
Does third party app integration needs to be enabled somewhere else ?
The does project in the source tree does not make any call to
register_urlconf, so I looked at the tests, but did not find much more
info there.

Thanks,
Nicolas.

faden

unread,
May 4, 2011, 8:01:27 AM5/4/11
to django-page-cms
Hi,

I just found you that it's necessary to execute the registry before
the admin is discovered, therefor in urls.py you need to do this:

from pages.urlconf_registry import register_urlconf
register_urlconf('test', 'pages.testsproject.documents.urls')

admin.autodiscover()

This is because the admin fields are handled in a rather static way.

Nico C.

unread,
May 4, 2011, 8:27:37 AM5/4/11
to django-page-cms
Yes, further digging into the code, I found that out too. So moving
the call a few lines up in my urls.py did the trick.

This because you should not have conditionnal fields inside the
FormAdmin class declaration, as the class declaration will be
only evaluated only once. If you want to add/remove fields
dynamically you must override the FormAdmin class __init__()
method.

I guess a little warning in the doc could help. I'm not very pleased
with the overriding __init__() thing, but it does work, I did that for
the
app i'm trying to integrate, which has forms that cope with
polymorphic
models. The code is a bit ugly and not so DRY in the end but it works.

Cheers.
Reply all
Reply to author
Forward
0 new messages