django-comments

Django: return one filtered object per foreign key

霸气de小男生 提交于 2020-01-15 03:21:06
问题 Is it possible to return querysets that return only one object per foreign key? For instance, I want the to get the latest comments from django_comments, but I only want one comment (the latest comment) per object, i.e., only return the latest comment on an object and exclude all the past comments on that object. I guess this would be similar to a sql group_by on django_comments.content_type and django_comments.object_pk. ++ADDED INFO++ The end goal is to create a list of active comment

Django Comments: Want to remove user URL, not expand the model. How to?

谁说我不能喝 提交于 2019-12-30 03:03:09
问题 I'm totally understanding the documentation on expanding the Comments app in Django, and really would like to stick with the automatic functionality but ... In the current app, I have absolutely no use for an "URL" to be submitted along with a comment. Being minimally invasive of the default setup, how can I prevent this field from showing up with the comment form ? Using Django 1, or Trunk, and as many generic/built-ins as possible (generic views, default comments set up, etc. I have only a

How to extend the comments framework (django) by removing unnecessary fields?

ぐ巨炮叔叔 提交于 2019-12-29 18:49:42
问题 I've been reading on the django docs about the comments framework and how to customize it (http://docs.djangoproject.com/en/1.1/ref/contrib/comments/custom/) In that page, it shows how to add new fields to a form. But what I want to do is to remove unnecesary fields, like URL, email (amongst other minor mods.) On that same doc page it says the way to go is to extend my custom comments class from BaseCommentAbstractModel , but that's pretty much it, I've come so far and now I'm at a loss. I

Django notification on comment submission

穿精又带淫゛_ 提交于 2019-12-21 20:20:12
问题 I am making use of Django's contrib.comments and want to know the following. Are there any utils or app out there that can be plugged into an app that sends you a notification when a comment is posted on an item? I haven't really worked with signals that much, so please be a little bit descriptive. This is what I came up with. from django.contrib.comments.signals import comment_was_posted from django.core.mail import send_mail if "notification" in settings.INSTALLED_APPS: from notification

A user with no email can't post a comment using Django's comments framework

人走茶凉 提交于 2019-12-19 09:49:18
问题 I have overrode the comments framework's form.html template with my own {% load comments i18n %} <form action="{% comment_form_target %}" method="post">{% csrf_token %} <div><input type="hidden" name="next" value="{{ request.get_full_path }}" /></div> {% for field in form %} {% if field.is_hidden %} <div>{{ field }}</div> {% else %} {% if field.name != "name" and field.name != "url" and field.name != "email" %} {% if field.errors %}{{ field.errors }}{% endif %} <p {% if field.errors %} class=

Using django_comments but getting 'QuerySet' object has no attribute '_meta'

南笙酒味 提交于 2019-12-13 06:08:34
问题 My django project named comments is here. It has an app comms which is there to display comments using django_comments . I have installed django_comments put it in INSTALLED_APPS field in settings.py have defined SITE_ID = 1 enabled the sites framework put url(r'^comments/', include('django_comments.urls')) in urls.py But this template file is giving me this error: AttributeError at / 'QuerySet' object has no attribute '_meta' What am I missing? 回答1: Change your home.html to something like: {

Accessing comments on an object via reverse relationship with Tastypie

≯℡__Kan透↙ 提交于 2019-12-13 05:14:15
问题 I'm building an API using Tastypie with Django and I've run into a bit of an issue. I have a model called a Moment (basically a blog post, with a title and body text), and I want to be able to attach comments to it and retrieve them via the API. I'm using django.contrib.comments with Django 1.6.5 and Tastypie 0.11.1. Now, according to the Tastypie documentation, this should be straightforward. What I've implemented is pretty close to that. This is my models.py : class Moment(models.Model): ""

How to use Django build-in comment framework on any template

北战南征 提交于 2019-12-13 03:06:30
问题 I just begin to study Django build-in comments function. at first I think the comment template should work well on any page just with get_comment_form or render_comment_form .but now it really annoying when i add these code to a ordinary page. It doesn't work. maybe in a other word. I don't know how to specify the object to attached to when it come to a normal page. below is the detail message : models.py class Entry(models.Model): title = models.CharField(max_length=250) body = models

Django: Redirect after posting a comment

北城以北 提交于 2019-12-12 12:07:04
问题 I am trying to redirect the user back to the page where the comment was posted. I found this post on Django's site but I am doing something wrong because it won't redirect back. Where should the input be placed to have it properly redirected? {% load comments i18n %} <form action="{% comment_form_target %}" method="post">{% csrf_token %} {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %} {% for field in form %} {% if field.is_hidden %} {{ field }} {% else %} {% if

Editing a Django Comment

99封情书 提交于 2019-12-11 20:16:05
问题 I'm attempting to edit an existing comment (i.e. replace old comment with a new one). My comments app is django.contrib.comments. new_comment = form.cleaned_data['comment'] #all of the comments for this particular review comments = Comment.objects.for_model(Review).filter(object_pk=review_id) print comments[0].comment #'old comment' comments[0].comment = new_comment print comments[0].comment #'old comment' is still printed Why is the comment not being updated with the new comment ? Thank you.