django xtd-comments, run sqldiff pls... and a bit of emailer 0.8
This commit is contained in:
parent
e8a0295a68
commit
17f6bbf687
|
@ -4,6 +4,11 @@ from models import *
|
|||
#from django.contrib.contenttypes import generic
|
||||
#from padmavideos.models import PadmaVideo, PadmaClip
|
||||
|
||||
# -- this is because settings.py uses
|
||||
# COMMENTS_APP = "django_comments_xtd", then Comment needs to be registered
|
||||
from django_comments_xtd import models as xtd
|
||||
admin.site.register(xtd.Comment)
|
||||
|
||||
#class AudioInline(admin.StackedInline):
|
||||
# model = Audio
|
||||
# extra = 2
|
||||
|
|
|
@ -277,7 +277,6 @@ class Play(ItfModel):
|
|||
title = models.CharField(max_length=512)
|
||||
author = models.CharField(max_length=512, blank=True)
|
||||
year = models.IntegerField(null=True, blank=True, max_length=4)
|
||||
|
||||
added_by = models.ForeignKey(User)
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -310,12 +309,14 @@ class TheatreGroup(ItfModel):
|
|||
#nature_of_work = models.CharField(max_length=255)
|
||||
# founded = models.CharField(max_length=10)
|
||||
trainings = generic.GenericRelation("Training")
|
||||
allow_comments = models.BooleanField('allow comments', default=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
def get_dict(self):
|
||||
return {
|
||||
#'object':self,
|
||||
'name': self.name,
|
||||
'email': self.email,
|
||||
'tel':self.tel,
|
||||
|
|
|
@ -97,6 +97,16 @@ def personpopup(request):
|
|||
form = PersonForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
instance = form.save()
|
||||
invitation = PersonInvitation(
|
||||
invitee=invitee,
|
||||
invite_code=User.objects.make_random_password(30),
|
||||
is_validated=False,
|
||||
inviter=Person.objects.get(user=request.user),
|
||||
sent_date=datetime.now()
|
||||
)
|
||||
invitation.save()
|
||||
invitation.send_mail()
|
||||
#return HttpResponse("<html><body>This person will be Invited!</body></html>")
|
||||
#return HttpResponse("<script>opener.dismissAddAnotherPopup(this, '%s', '%s')</script>" % (str(instance.id), instance.get_title()))
|
||||
else:
|
||||
form = PersonForm()
|
||||
|
|
|
@ -231,8 +231,14 @@ INSTALLED_APPS = (
|
|||
'allauth.socialaccount.providers.facebook',
|
||||
'allauth.socialaccount.providers.github',
|
||||
'emailconfirmation',
|
||||
'django_comments_xtd',
|
||||
)
|
||||
|
||||
#j comments-xtd
|
||||
COMMENTS_APP = "django_comments_xtd"
|
||||
COMMENTS_XTD_CONFIRM_EMAIL = True
|
||||
COMMENTS_XTD_MAX_THREAD_LEVEL = 0 # no threading
|
||||
|
||||
|
||||
# jj all auth + email settings
|
||||
LOGIN_REDIRECT_URL = '/edit_profile'
|
||||
|
|
20
itf/templates/comments/form.html
Normal file
20
itf/templates/comments/form.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% load comments i18n %}
|
||||
<form action="{% comment_form_target %}" method="post">{% csrf_token %}
|
||||
{% if next %}<div><input type="hidden" name="next" value="{{ next }}" /></div>{% endif %}
|
||||
{% for field in form %}
|
||||
{% if field.is_hidden %}
|
||||
<div>{{ field }}</div>
|
||||
{% else %}
|
||||
{% if field.errors %}{{ field.errors }}{% endif %}
|
||||
<p
|
||||
{% if field.errors %} class="error"{% endif %}
|
||||
{% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
|
||||
{{ field.label_tag }} {{ field }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<p class="submit">
|
||||
<input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" />
|
||||
<input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
|
||||
</p>
|
||||
</form>
|
10
itf/templates/comments/list.html
Normal file
10
itf/templates/comments/list.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<dl id="comments">
|
||||
{% for comment in comment_list %}
|
||||
<dt id="c{{ comment.id }}">
|
||||
{{ comment.submit_date }} - {{ comment.name }}
|
||||
</dt>
|
||||
<dd>
|
||||
<p>{{ comment.comment }}</p>
|
||||
</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
8
itf/templates/comments/posted.html
Normal file
8
itf/templates/comments/posted.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% extends "comments/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "Thanks for commenting" %}.{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% trans "Thank you for your comment" %}.</h1>
|
||||
{% endblock %}
|
36
itf/templates/comments/preview.html
Normal file
36
itf/templates/comments/preview.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{% extends "comments/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "Preview your comment" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% load comments %}
|
||||
<form action="{% comment_form_target %}" method="post">{% csrf_token %}
|
||||
{% if next %}<div><input type="hidden" name="next" value="{{ next }}" /></div>{% endif %}
|
||||
{% if form.errors %}
|
||||
<h1>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1>
|
||||
{% else %}
|
||||
<h1>{% trans "Preview your comment" %}</h1>
|
||||
<blockquote>{{ comment|linebreaks }}</blockquote>
|
||||
<p>
|
||||
{% trans "and" %} <input type="submit" name="submit" class="submit-post" value="{% trans "Post your comment" %}" id="submit" /> {% trans "or make changes" %}:
|
||||
</p>
|
||||
{% endif %}
|
||||
{% for field in form %}
|
||||
{% if field.is_hidden %}
|
||||
<div>{{ field }}</div>
|
||||
{% else %}
|
||||
{% if field.errors %}{{ field.errors }}{% endif %}
|
||||
<p
|
||||
{% if field.errors %} class="error"{% endif %}
|
||||
{% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
|
||||
{{ field.label_tag }} {{ field }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" class="submit-post" value="{% trans "Post" %}" />
|
||||
<input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
|
||||
</p>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -202,6 +202,32 @@
|
|||
|
||||
<div id="notes" class="tab_content">
|
||||
|
||||
{% load comments %}
|
||||
|
||||
<div id="comments">
|
||||
{% get_comment_count for obj as comment_count %}
|
||||
{% if comment_count %}
|
||||
<H4 class="center">{{ comment_count }} comment{{ comment_count|pluralize }}</H4>
|
||||
{% endif %}
|
||||
<div id="comment-list">
|
||||
{% render_comment_list for obj %}
|
||||
</div>
|
||||
{% if obj.allow_comments and user.is_authenticated %}
|
||||
<H4 class="center">your comment</H4>
|
||||
<div id="comment-form">
|
||||
{% render_comment_form for obj %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if user.is_authenticated %}
|
||||
<h4 class="center"> Comments are disabled for this article</h4>
|
||||
{% else %}
|
||||
<h4 class="center"> </h4>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% if awards %}
|
||||
<div id="" class="itfFormDisplay">
|
||||
<span class="orange">Awards: </span>
|
||||
|
|
|
@ -24,7 +24,8 @@ urlpatterns = patterns('',
|
|||
(r'^contact/$', 'frontpage.views.contact'),
|
||||
(r'^emailer/issue/(?P<issue_no>\d+)/$', 'emailer.views.show_emailer'),
|
||||
# ('m/(?P<module_slug>.*)', 'insidepages.views.main'),
|
||||
(r'^comments/', include('django.contrib.comments.urls')),
|
||||
#(r'^comments/', include('django.contrib.comments.urls')),
|
||||
url(r'^comments/', include('django_comments_xtd.urls')),
|
||||
# (r'^ckeditor/', include('ckeditor.urls')),
|
||||
(r'^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}),
|
||||
# (r'^erang/', include('erang_organised.urls')),
|
||||
|
|
2
migrations/sqldiff12_11_1.sql
Normal file
2
migrations/sqldiff12_11_1.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `itfprofiles_theatregroup`
|
||||
ADD `allow_comments` bool;
|
|
@ -22,5 +22,6 @@ django-markitup
|
|||
twitter
|
||||
-e git+git://github.com/pennersr/django-allauth.git#egg=django-allauth
|
||||
-e git+git://github.com/pythonforfacebook/facebook-sdk.git#egg=facebook-sdk
|
||||
django-comments-xtd
|
||||
django-avatar
|
||||
imagestore
|
||||
|
|
Loading…
Reference in New Issue
Block a user