Ales Zoulek avatar Ales Zoulek committed 0d68ef6

ssi comments

Comments (0)

Files changed (6)

ng_proxy_test/content/templates/detail.html

+{% load comments %}
 <html>
 <body>
 
 
 <h2>{{article.name}}</h2>
 <div>{{article.text}}</div>
+{% if settings.USE_SSI %}
+<!--# include virtual="{% url ssi-comments-list article.pk %}" -->
+{% else %}
+{% render_comment_list for article %}
+{% endif %}
 
 </body>
 </html>

ng_proxy_test/content/templates/ssi_comments_list.html

+{% load comments %}
+{% render_comment_list for article %}

ng_proxy_test/content/urls.py

 urlpatterns = patterns('ng_proxy_test.content.views',
     url(r'^$', 'homepage', name='homepage'),
     url(r'^article/(?P<pk>\d+)/$', 'detail', name='detail'),
+    url(r'^ssi/comments/list/(?P<pk>\d+)/$', 'ssi_comments_list', name='ssi-comments-list'),
 )
 

ng_proxy_test/content/views.py

 from django.shortcuts import render_to_response
+from django.conf import settings
 
 from ng_proxy_test.content.models import Article
 
     return render_to_response(
         'detail.html',
         {
+            'settings': settings,
+            'article': Article.objects.get(pk=pk)
+        },
+    )
+
+def ssi_comments_list(request, pk):
+    return render_to_response(
+        'ssi_comments_list.html',
+        {
             'article': Article.objects.get(pk=pk)
         },
     )

ng_proxy_test/settings.py

     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'django.contrib.comments',
     # Uncomment the next line to enable the admin:
     'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
         },
     }
 }
+
+
+USE_SSI = True

ng_proxy_test/urls.py

     # Examples:
     # url(r'^$', 'ng_proxy_test.views.home', name='home'),
     url(r'^admin/', include(admin.site.urls)),
+    url(r'^comments/', include('django.contrib.comments.urls')),
     url(r'', include('ng_proxy_test.content.urls')),
 
     # Uncomment the admin/doc line below to enable admin documentation:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.