Django: access part of model with tags

I cloned a project from GH and one of things I did was add a DOB part to the user model. However whenever I try to access it through a template tag- it doesn’t work.

Can someone help???

user model
Form code

FYI- i tried

{{ user.birth_year }} 
1 Like

is there some kind of database migration step you need?

1 Like

well I already migrated as needed, I just want to access the model data like you would with (( ))

1 Like

It is a safe bet that wh0 mentioned it because there is no particular reason that things that worked prior to renaming the column should fail after renaming the column… except perhaps that it didn’t get renamed.

What I do in these cases is to write a simple function that queries the DB and place it in some startup code or an if (dbTest) block. Have it fetch data from the database. Obviously the column but anything else that may seem relevant, table names, the db schema, etc. You want to be certain the data is as you believe it to be if there is nothing up with the code.


Thanks! I’ll give this a try

1 Like

Hi, i tried what @tleylan said. The .schema command in sqlite throws up everything but this part I added.

So I made some changes and now it works! Thanks to all who helped

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.