Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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 %}