[Answer]-Django: best way to accessing a ForeignKey value from template

1👍

First please edit your question to use the proper “ForeignKey to X”, its hard to tell what your FKs go.

But to answer your question, foo_id is the integer represenation of the foo FK field.

that is, print record.exercise will call __unicode__() on the exercice model to get the represenation to print, print record.exercise_id will print the actual FK id.

👤krs

Leave a comment