1. Ales Zoulek
  2. ng_proxy_test

Commits

Ales Zoulek  committed 0d68ef6

ssi comments

  • Participants
  • Parent commits c7c1292
  • Branches master

Comments (0)

Files changed (6)

File ng_proxy_test/content/templates/detail.html

View file
+{% 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>

File ng_proxy_test/content/templates/ssi_comments_list.html

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

File ng_proxy_test/content/urls.py

View file
 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'),
 )
 

File ng_proxy_test/content/views.py

View file
 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)
         },
     )

File ng_proxy_test/settings.py

View file
     '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

File ng_proxy_test/urls.py

View file
     # 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: