Hi Matt,

Have a read here, noting the reference to "page.author", as "Author" is the
page type:

http://mezzanine.jupo.org/docs/content-architecture.html#displaying-custom-content-types

You'll see you probably want something like:

{% comments_for page.commentpage %}


On Sun, Jul 6, 2014 at 2:00 PM, Matt Gushee <[email protected]> wrote:

> Hello, Mezzanites--
>
> I am new to Mezzanine and Django (though not to Python, fortunately)
> ... I have worked through the Django and Mezzanine tutorials, and I am
> starting to work on a real site.
>
> (BTW, for some reason I was initially planning to build the site with
> Drupal. Uergh. Mezzanine is really a breath of fresh air after that.)
>
> One of the key features I want to implement is a kind of shared
> workspace for a small group of collaborators (2-3 people at first, and
> I'll be surprised if the number ever reaches 20), where people can
> share documents and comment on each other's work. I think either a
> blog or a forum could be used for this purpose, but neither is quite
> right. I think the best thing would be a rich text page with comments.
>
> So I determined to create a 'CommentedPage' type. Oh, and by the way,
> I want to use the builtin threaded comments. I know, I know, Disqus.
> Sorry, but I really do not want to use Disqus if I can help it.
>
> Anyway, I think I have partially succeeded in implementing the new
> page type; I can add a CommentedPage via the admin interface, but when
> I try to view the result I get a template rendering error. Here's
> what's going on:
>
> 1. Created a 'workspace' app.
>
>      I haven't put it into pip-installable form yet, but it lives in a
> separate directory. The structure looks like:
>
>          test/
>              pyenv/              # virtualenv stuff
>              salix_site/        # the actual site
>              workspace/     # the app
>                  __init__.py
>                 admin.py
>                 models.py
>                 templates/
>                     workspace/
>                         commentedpage.html
>                 tests.py
>                 views.py
>
> 2. Models.py looks like this:
>
>     from django.db import models
>     from mezzanine.pages.models import Page
>     from mezzanine.core.models import RichText
>     from mezzanine.generic.fields import CommentsField
>
>    class CommentedPage(Page, RichText):
>          comments = CommentsField()
>
> 3. Admin.py looks like this:
>
>     from django.contrib import admin
>     from mezzanine.pages.admin import PageAdmin
>     from .models import CommentedPage
>
>     admin.site.register(CommentedPage, PageAdmin)
>
> 4. And the template, commentedpage.html looks like this:
>
> {% extends "pages/page.html" %}
>
> {% load mezzanine_tags comments comment_tags %}
>
> {% block main %}{{ block.super }}
>
> {% editable page.commentedpage.content %}
> {{ page.commentedpage.content|richtext_filters|safe }}
> {% endeditable %}
>
> {% comments_for page %}
>
> {% endblock %}
>
>
> When I attempt to view the page, I get:
>
>     AttributeError at /junk/my-ahh-commented-page-you-know/
>
>     'Page' object has no attribute 'comments'
>
> ... and a whole bunch more, but I'm not sure what is relevant.
> However, a couple of relevant points:
>
> * According to the Debug Toolbar, the 'commentedpage.html' template is
> being called.
>
> * However, the actual error appears to be happening in the builtin
> 'comments.html' template:
>
>      Error during template rendering
>
>      In template /PATH/TO/templates/generic/includes/comments.html,
> error at line 16
>
> ... where line 16 reads:
>
>     {% comment_thread object_for_comments %}
>
>
> Can anyone give me a hint as to what is going on here? Thanks!
>
> --
> Matt Gushee
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to