From 2b38042798477972284626f86a19fcededd9d844 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Tue, 26 May 2015 10:20:42 +0200 Subject: [PATCH] Added full threaded comments (to Problem for now) --- mamweb/settings_common.py | 14 ++++++++++++++ mamweb/static/css/mamweb.css | 10 ++++++++++ mamweb/templates/base.html | 4 ++++ mamweb/urls.py | 11 ++++++++++- requirements.txt | 8 +++++++- seminar/templates/seminar/problem.html | 8 ++++++++ 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 6214ce41..18949127 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -99,6 +99,11 @@ INSTALLED_APPS = ( 'taggit', 'autocomplete_light', + 'fluent_comments', + 'crispy_forms', + 'threadedcomments', + 'django_comments', + # MaMweb 'mamweb', 'seminar', @@ -159,6 +164,13 @@ CKEDITOR_CONFIGS = { } +# Comments + +COMMENTS_APP = 'fluent_comments' +#COMMENTS_APP = 'threadedcomments' +FLUENT_COMMENTS_EXCLUDE_FIELDS = ('name', 'email', 'url', 'title') + + # SECURITY WARNING: keep the secret key used in production secret! # Create file 'django.secret' in every install (it is not kept in git) @@ -168,6 +180,8 @@ try: except: SECRET_KEY = '12345zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzdqwkdlkj' + + # MaM specific SEMINAR_RESENI_DIR = os.path.join(BASE_DIR, 'media', 'reseni') diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 9f6b779a..1e6f003b 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -30,3 +30,13 @@ table .border-b { .vysledkovka { border: solid 2px; } + + +/* Comments */ + +#id_comment { + width: 100%; + height: 6em; +} + + diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index 864387e6..f9dcf422 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -12,6 +12,10 @@ {% include 'autocomplete_light/static.html' %} + + + + diff --git a/mamweb/urls.py b/mamweb/urls.py index eb564ebe..56b8ce6e 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -7,12 +7,21 @@ from django.views.generic.base import TemplateView urlpatterns = i18n_patterns('', + # Admin a nastroje url(r'^admin/', include(admin.site.urls)), # NOQA - url(r'^admin_tools/', include('admin_tools.urls')), url(r'^ckeditor/', include('ckeditor.urls')), url(r'^autocomplete/', include('autocomplete_light.urls')), + + # Seminarova aplikace (ma vlastni podadresare) url(r'^', include('seminar.urls')), + + # Comments (interni i verejne) + url(r'^comments_dj/', include('django_comments.urls')), + url(r'^comments_fl/', include('fluent_comments.urls')), + + # Obsah url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'), + ) # This is only needed when using runserver. diff --git a/requirements.txt b/requirements.txt index 6e398b41..14be2256 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,13 @@ django-ckeditor==4.4.7 django-flat-theme==0.9.3 django-taggit==0.14.0 django-autocomplete-light==2.1.1 -# django-admin-tools==0.5.2 +django-crispy-forms==1.4.0 + +# Comments +akismet==0.2.0 +django-fluent-comments==1.0.2 +django-threadedcomments==1.0b1 +django-contrib-comments==1.6.1 # debug tools/extensions diff --git a/seminar/templates/seminar/problem.html b/seminar/templates/seminar/problem.html index acb3d075..1b9b364c 100644 --- a/seminar/templates/seminar/problem.html +++ b/seminar/templates/seminar/problem.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% load comments %} + {% block content %}

Problém {{ problem.kod_v_rocniku }} {{ problem.nazev }}

@@ -13,8 +15,14 @@ {% if True %}
+

Text - org

{{ problem.text_problemu_org |safe }} + +

Diskuse - org

+ {% render_comment_list for object %} + {% render_comment_form for object %} +
{% endif %}