from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.views.generic.list_detail import object_detail, object_list
from threadedcomments.models import ThreadedComment
-from threadedcomments.views import free_comment
+from threadedcomments.views import free_comment, _preview
from xerxes.influences.models import Character
from xerxes.influences.models import Influence
from forms import get_influence_comment_form, InfluenceForm, CharacterForm
os = Influence.objects.filter(character__player=request.user)
return render_to_response('influences/influence_list.html', {'object_list' : os}, RequestContext(request))
+def influence_comment_preview(request, context_processors, extra_context, **kwargs):
+ # Use a custom template
+ kwargs['template'] = 'influences/influence_comment_preview.html'
+ # The base template to extend
+ extra_context['base'] = "influences/influence_detail.html"
+ # The object to be show in the influence detail
+ extra_context['object'] = get_object_or_404(Influence, pk=kwargs['object_id'])
+ return _preview(request, context_processors, extra_context, **kwargs)
+
@login_required
def influence_detail(request, object_id):
# that hardcodes the form_class.
kwargs['model'] = ThreadedComment
# Set a custom preview view
+ kwargs['preview'] = influence_comment_preview
if parent_id:
kwargs['prefix'] = "reply-to-%s" % (parent_id)
return free_comment(request, object_id=object_id, edit_id=edit_id, **kwargs)