开发者

Integrating existing django application with django-cms

开发者 https://www.devze.com 2023-02-14 23:15 出处:网络
I have an existing django application, with which I need to integrate django-cms. Django-cms will be mainly used to create help documents for the application. I\'ve setup django-cms to use my existing

I have an existing django application, with which I need to integrate django-cms. Django-cms will be mainly used to create help documents for the application. I've setup django-cms to use my existing database, so as to keep users and auth consistent.

Ideally in a help page, I would be needing client specific information from my existing application, and also provide editing functionality to the documentation team.

Here is a sample view which I wrote:

def view_help(request, company):
    try:
        c = Company.objects.get(id=company)
    except:
        return render_to_response('help.html', {'msg':'No Such company'})

    return render_to_response('help.html', {'company':c, 'data':c.data})

Corresponding template help.html:

{% load cms_tags %}
{% load custom_tags %}

<!doctype html>
<head>
  <title>{{company}}</title>
     {% plugins_media %}
</head>
<body>
    {% placeholder "main" %}

{% if msg %}
    {{msg}}

{% else %}
    Here is company specific data: <br/> 
    {{ data }}    
{% endif %}
</body>
</html>

This gives me the company specific information I need, but doesn't give me the cms plugins.

Any help here would be much appreciated. Thanks.

--- Edit --- Moved the edited section to a new 开发者_如何学Goquestion


You need to attach the application's view to a cms page using a django-cms apphook.

0

精彩评论

暂无评论...
验证码 换一张
取 消