Sunday, March 1, 2015

Chapter 6 - Models and Databases - populate_rango.py

In the text for populate_rango.py, make sure to remove the indents in the add_page function:

def add_page(cat, title, url, views=0):
    p = Page.objects.get_or_create(category=cat, title=title)[0]
        p.url=url
        p.views=views
        p.save()
    return p

p.url, p.views and p.save() should not be indented here.

No comments:

Post a Comment