Hi my client is desperate to integrate django disqus into the blog we have built for them. I stumbled upon https://github.com/arthurk/django-disqus django disqus app and couldnt believe my luck, i had this up and running in no time, everything appears to be working ok, im posting comments etc however it dosent seem to be identifying properly as a comment posted with object.id for one blog post appears for all posts through out the blog.
in the index template that lists all the blog posts out i have
{% for entry in entries %}
{% set_disqus_identifier entry.id %}
{% set_disqus_url entry.get_absolute_url %}
{% set_disqus_developer 1 %}
{% blog stuff goes here %}
{%endfor%}
in the article template i have
{% set_disqus_identifier entry.id %}
{% set_disqus_url entry.get_absolute_url %}
{% set_disqus_developer 1 %}
<section id="comments">
View Comments
<h1>{% disqus_num_replies %}</h1>
<article class="comment">
{% disqus_dev %}
{% disqus_show_comments entry.get_absolute_url %}
the problem as i mentioned before is that if i post one comment disqus is applying that to all the blog posts. I guess im doing something wrong with the identifiers, but when i view source the javascript is getting the right id for each blog post
I really need this to work so will be eternally grateful for any help or advice that has got this working
in your index template, you don't need to do all this set_* stuff. So just load the dev tag to enable local development:
{% disqus_dev %}
{% for entry in entries %}
{% blog stuff goes here %}
{% endfor %}
In your article template just do this to display the comments. The disqus javascript will use the current URL as the identifier, so there's no need to set it manually:
{% disqus_show_comments %}
Don't forget to set the settings to the correct values as described in the documentation: http://django-disqus.readthedocs.org/en/latest/installation.html#configuring-your-django-installation And also change the url of your Site object to your actual domain.
I think you should not set the identifier and other values in index template. Because of the for loop its overriding the previous values. Rather, you should set the values in template related to particular post. That way, you would be setting disqus parameters for that particular post.
Note: django-disqus has newer version now, with django 1.7 support.
Related
Referring to following documentation, I am trying this
https://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching
{% cache 500 sidebar request.user.username %}
{% if user.is_authenticated %}
{{ user.first_name}}
{% endif %}
{% endcache %}
The problem is my authenticated Name and picture is getting cached and seen by other users, and those of other users by some other user. Essentially anyone coming in hits the cache of previous chap visiting the web site.
Apart from this no user access or any other security issue is not there.
Can you advise why this is so and what is the solution to the problem.
I am following this solution to show whether a user is online or not.
But when I try to add:
'userprofile.middleware.ActiveUserMiddleware',
to MIDDLEWARE_CLASSES, I get a 502 error.
{{ profile.online }} returns false.
Thank you for any help.
UPDATE
It seems to work now without the middleware.
{% if object.profile.is_online %}
Online
{% else %}
Offline
{% endif %}
I have a list of users called "recommended".
{% recommended request user %}
Can I check within the template if these users are online?
{% recommended request user.is_online %}
does not work.
Thank you for any help / resource on this topic
I found a solution.
Django-online-users works perfectly fine.
I'm kinda new to Django, I'm working on a project that requires user to user messaging, so I decided to use Django postman. I was able to install in my project folder but the problem I'm facing has to do with pagination. The inbox should paginate after 20 messages but does not.
base_folder.html
<p>
<div id="postman">
<h1>{% block pm_folder_title %}{% endblock %}</h1>
{% autopaginate pm_messages %}
{% if invalid_page %}
<p>{% trans "Sorry, this page number is invalid." %}</p>
{% else %}
{% if pm_messages %}
{% b
lock pm_by_modes %}<div id="pm_byModes">
</p>
Really need help guys
According to FAQ in django-postman docs:
I installed django-pagination, and still I don’t see any pagination widgets
Is there really more messages than one page capacity (default is 20)?
Check that pagination is declared before postman in the INSTALLED_APPS setting.
See if it’s better by disabling postman/templatetags/pagination_tags.py and .pyc (rename or move the files).
I'm using Django CMS and the Aldryn News Blog app on a client site to display a blog listing. The default template code uses
{% render_model article "lead_in" %}
to display the "Lead in" excerpt text. However it is displaying p tags for me and I actually need them to render.
https://pasteboard.co/GSq8XObQ.png
https://pasteboard.co/GSq8ONF.png
I have tried both:
{% autoescape off %}
{% render_model article "lead_in" %}
{% endautoescape %}
{% render_model article "lead_in" |safe %}
The first does nothing and the second errors out. How can I get it to render the html tags?
Have you tried this solution?
{{ article.lead_in|safe }}
I use the obvious powerful registration 0.8 alpha version. I do have to questions.
1.) I want to add the checkbox RegistrationTermsOfService at the registration form html file. I just don't know how to do it. Please don't give me an link on uebernstorm docs. Just tell me please how to do it. I have read and tried a lot and it actually doesn't work. I am dispairing!
2.) The activation email is send with the activation key. When I click on activation the account is getting activated in the database but the template says something different. It says:"Sorry, it didn't work. Either..."
I use the standard activate.html below:
{% extends "base.html" %}
{% block title %}Account activated{% endblock %}
{% block content %}
Account activated
{% load humanize %}
{% if account %}
Thanks for signing up! Now you can "href"
{% else %}
Sorry, it didn't work. Either your activation link was incorrect, or
the activation key for your account has expired; activation keys are
only valid for {{ expiration_days|apnumber }} days after
registration.
{% endif %}
{% endblock %}
PLEASE, PLEASE help me!!! I am dispairing!!!
Craphunter
For 1) you need to use a different form. Look in registration.forms for the one you need and pass it as an additional argument in the backend's urls.py
For 2) we'll need more info - is the URL correct? Is there a RegistrationProfile object created for the user account in question? What is the value of the key?