When displaying the Japanese name on the shift table, when I wanted to display the information of the table specified by ForeingKey in various ways, I could not do it anyway, so I passed it from Views to the template. ..
The user and profile are tied together, and object_list refers to the foreign key by the user, but I didn't know how to call it, and I didn't know if it was getting it together, so I knead it with a template. Was there.
It's really processed with for and if (laughs) I think this is fine, but ...
When I was investigating something different, there was information that I could get it by specifying the field that references the foreign key and then specifying the field. So a little experiment.
Is it possible to get the start time from the externally referenced shift name, or to get the name from the user table?
I will try to output with this.
I was able to output (⌒∇⌒)
DJango seems to get all the related tables. I'm grateful that you can create it without having to remember the SQL statement.
HTML, CSS, Django, Python, javascript, how much would it be if SQL were added to this, but it's convenient.
It should be possible to display with "dictionary + external reference field name + field name you want to acquire". This will reduce the number of times it is retrieved from the database, so it seems that the time until it is displayed can be reduced.
I would also like to modify the shift table when I make some changes.
You can learn and practice new things
This is fun, isn't it: middle_finger_tone1:
Recommended Posts