Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

get_absolute_url uses incorrect url_for arguments. #2

Open
adamlwgriffiths opened this issue Jun 1, 2013 · 0 comments
Open

get_absolute_url uses incorrect url_for arguments. #2

adamlwgriffiths opened this issue Jun 1, 2013 · 0 comments

Comments

@adamlwgriffiths
Copy link

Post defines the following function

def get_absolute_url(self):
        return url_for('post', kwargs={"slug": self.slug})

This function isn't used in the tutorial, but calling it results in a BuildError exception.
The Blueprint for Post is 'posts' not 'post'.
It also doesn't define which 'function' to call, Ie 'posts.detail' or 'posts.list'.

The correct code should be

def get_absolute_url(self):
        return url_for('posts.detail', slug=self.slug)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant