How would one go about troubleshooting "represent"?
I am at the point where the ID matches the data I am looking for however it is not showing the title for the matching ID.
Specifically I have categories held in this table:
db.define_table('category',
Field('title'),
Field('slug',requires=IS_SLUG(),compute=lambda row: IS_SLUG.urlify(row.title)),
Field('parent_id','reference category', default=None))
I have a table where these categories will be used:
db.define_table('animals',
Field('name'),
Field('breed'),
Field('category', db.category),
)
I then exclude certain categories I don't want them to be able to post in:
catwanted = []
notwanted = ['Dogs','Cats','MiscPets']
for row in db(db.category).select():
if row.title in notwanted:
pass
else:
catwanted.append(row.title)
catwanted.sort()
Then I have a form where I want to represent the title of the
category.id it references so I use represent:
db.animals.category.represent = lambda f: db.category[f].title
Instead of showing me the title it shows me the id of that category when I go to edit the record using crud.update.
I had this issue before however the only difference is that I did not exclude anything, and it was not a dropdown; specifically I used this same exact thing to show me the name of the Animal when updating the status of the pet.
No matter what or where I do with represent it doesn't change the list from the the ID to the title.
I even tried creating this all from scratch and it does exactly the same thing, shows the ID but, not the title of the category.