5
我有一個現有的django應用程序,我需要集成django-cms。 Django-cms將主要用於爲應用程序創建幫助文檔。我已經設置了django-cms來使用我現有的數據庫,以保持用戶和auth的一致性。將現有的django應用程序與django-cms集成
理想情況下,在幫助頁面中,我將需要來自現有應用程序的客戶端特定信息,並且還向文檔團隊提供編輯功能。
這裏是我寫的一個樣本視圖:
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})
相應的模板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>
這給了我,我需要本公司的具體信息,但不給我cms插件。
任何幫助在這裏將不勝感激。 謝謝。
---編輯--- 感動編輯區段到一個新的問題
我試圖訪問這些文檔時遇到權限被拒絕錯誤。 有什麼想法? – 2016-09-10 23:32:20
@OlegTikhonov這裏是可訪問的鏈接http://docs.django-cms.org/en/release-3.3.x/how_to/apphooks.html – 2016-11-29 14:11:24