Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Basel Barzanji
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Basel Barzanji
Python Web Development Techdegree Graduate 20,706 Points

Getting <bound method > error in posts table

Using pycharm - forgot to include () for content=TextField - included them and modified table manually to include content text field, everything working fine but getting this statement from peewee where I am supposed to have the number of posts by the user

<bound method SelectQuery.count of <class 'models.Post'> SELECT "t1"."id", "t1"."timestamp", "t1"."user_id", "t1"."content" FROM "post" AS t1 WHERE ("t1"."user_id" = ?) ORDER BY "t1"."timestamp" DESC [5]>

1 Answer

Basel Barzanji
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Basel Barzanji
Python Web Development Techdegree Graduate 20,706 Points

Figured it out, forgot to include () in user.post.count() in user_stream.html

{% extends "stream.html" %}

{% block content %}
    <div class="row">
        <div class="grid-25">
            <h1>{{ user.username }}</h1>
        </div>
        <div class="grid-50">
            <div class="grid-33">
                <h5>Posts</h5>
                <p>{{ user.posts.count() }}</p>
            </div>
            <div class="grid-33">
                <h5>Followers</h5>
                <p>0</p>
            </div>
            <div class="grid-33">
                <h5>Following</h5>
                <p>0</p>
            </div>
        </div>
        <div class="grid-25">
            <!-- Follow/unfollow button -->
        </div>
    </div>
    {{ super() }}
{% endblock %}