Could the comments framework be more generic?

16 views
Skip to first unread message

Kevin Renskers

unread,
Nov 27, 2010, 6:55:13 PM11/27/10
to Django developers
Hi,

I'd like to make a suggestion about the build in comments framework.
Right now, even though you can write your own extension to the
comments framework, it is always tied to database models. I am trying
to build an extension that uses the API offered by Disqus, meaning I
don't want to use the local database to do a count of comments, get
the list of comments, etc.

If Django's comments framework would offer an API that is one level
above the database models, we could write our own functions that
implement getting comments, saving them, do a count of comments for
the object, etc.

I understand that a logical reaction to this suggestion would be to
just not use Django's comments app, but roll my own. But I want to
integrate the Disqus comments with existing apps, that already use
Django's system to, for example, show the count of comments on blog
articles in the admin interface. Django-blog-zinnia does this.

I am looking forward to any comments and ideas. Is something like this
even possible without completely breaking backwards compatibility?

Kind regard,
Kevin Renskers

Jamie Rumbelow

unread,
Nov 27, 2010, 8:17:43 PM11/27/10
to django-d...@googlegroups.com
Hello All,

Kevin's got a point, and actually, why aren't Django's components abstracted as a generic rule? Things like django.contrib.session and django.contrib.comments could be easily abstracted to allow for pluggable drivers into other backends quite easily. It'd be easy to make backward-compatible and would be VERY helpful.

My best,

Jamie


--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.




--
Jamie Rumbelow developer/writer/speaker
+44 (0)7956 363875 ja...@jamierumbelow.net

Russell Keith-Magee

unread,
Nov 27, 2010, 11:51:37 PM11/27/10
to django-d...@googlegroups.com
On Sun, Nov 28, 2010 at 9:17 AM, Jamie Rumbelow <ja...@jamierumbelow.net> wrote:
> Hello All,
> Kevin's got a point, and actually, why aren't Django's components abstracted
> as a generic rule? Things like django.contrib.session and
> django.contrib.comments could be easily abstracted to allow for pluggable
> drivers into other backends quite easily. It'd be easy to make
> backward-compatible and would be VERY helpful.

Well, contrib.sessions is already pluggable -- that's what the
SESSION_ENGINE setting is for.

As for other contrib apps -- the reason is that either they're not
inherently pluggable (e.g., webdesign), or that nobody has made the
suggestion, or that nobody has done the work to make them pluggable.

I'm generally in favor of anything that introduces a pluggable backend
API that allows end-users to extend the functionality of Django's
core. However, it's impossible to make any judgement in the absence of
a specific API proposal. It's extremely easy to say "this can be done
in a backwards compatible fashion". It's another thing entirely to put
the effort into actually building a backwards-compatible patch.

Yours,
Russ Magee %-)

sub...@gmail.com

unread,
Nov 28, 2010, 11:19:54 AM11/28/10
to Django developers
Heh, already put a few hours doing something like this. There's some
django-discus attempts out there--have you looked at them? I haven't
bothered to notice if any use the comments framework but it sure would
be handy to make comments out of discus or backtype feeds or variants
thereof.

But whether it was in trunk or just somewhere on github, I'd use it
either way. In my thinking about doing this I never really ran into a
compatibility/patch issue. Did you?

-Steve

Kevin Renskers

unread,
Nov 28, 2010, 1:29:24 PM11/28/10
to Django developers
The existing apps use the JavaScript interface offered by Disqus. This
does not integrate with apps that expect Django's comments app.

I've made good progress on my comments app extension that uses Disqus,
but now I am at a point where the models are working against me. Code
is on bitbucket: http://bitbucket.org/bolhoed/django-disqus-comments/.
I think that from this code the problem of the current situation is
clear.

I'd be more then happy to work on a new comments API for Django by the
way!

Kevin

Kevin Renskers

unread,
Nov 28, 2010, 3:35:28 PM11/28/10
to Django developers

Thejaswi Puthraya

unread,
Nov 28, 2010, 11:52:39 PM11/28/10
to Django developers
Hi,
I am the student who worked on improving the comments framework a
couple of years back and have been absconding since then ;-)
Personally, I would love to see the comments app out of contrib
because of the need to maintain backwards compatibility especially for
an app with very few users.

On Nov 28, 4:55 am, Kevin Renskers <i...@bolhoed.net> wrote:
> Hi,
>
> I'd like to make a suggestion about the build in comments framework.
> Right now, even though you can write your own extension to the
> comments framework, it is always tied to database models. I am trying
> to build an extension that uses the API offered by Disqus, meaning I
> don't want to use the local database to do a count of comments, get
> the list of comments, etc.

Can you be specific on how the current setup is preventing you from
getting it done?

>
> If Django's comments framework would offer an API that is one level
> above the database models, we could write our own functions that
> implement getting comments, saving them, do a count of comments for
> the object, etc.

Apart from a model backend what other backends are we looking at to
store comments?

>
> I understand that a logical reaction to this suggestion would be to
> just not use Django's comments app, but roll my own. But I want to
> integrate the Disqus comments with existing apps, that already use
> Django's system to, for example, show the count of comments on blog
> articles in the admin interface. Django-blog-zinnia does this.
>
> I am looking forward to any comments and ideas. Is something like this
> even possible without completely breaking backwards compatibility?

If it is a clean proposal, it might be possible to convince the core
devs to break the backwards compatibility rule. You can count me in
for any kind of help regarding this task.

--
Cheers
Theju

Kevin Renskers

unread,
Nov 29, 2010, 5:02:57 PM11/29/10
to Django developers
> Can you be specific on how the current setup is preventing you from
> getting it done?

I think the easiest way is to look at my code on bitbucket, for
example my models.py: https://bitbucket.org/bolhoed/django_disqus_comments/src/b2c6fbb025f6/models.py.
As you can see, I have to hack my own model manager and queryset, just
to be able to use the Disqus API instead of models on the local
database.

> Apart from a model backend what other backends are we looking at to
> store comments?

Whatever you would want. If you make abstract base classes for getting
comments for an object, getting the count of comments, and saving a
new comment, everyone could make their own backend. You could use
Twitter for comments (with a hashtag), Disqus, a nonsql database,
textfiles...

However, I would only ship the models backend by default.

> If it is a clean proposal, it might be possible to convince the core
> devs to break the backwards compatibility rule. You can count me in
> for any kind of help regarding this task.

Cool, thanks. I think my basic idea should be pretty clear: just offer
an extra layer of abstraction above the ORM for the comments. I am not
sure what the best way to do this would be, but I should have plenty
of time this week to look into it.

Cheers,
Kevin
Reply all
Reply to author
Forward
0 new messages