Jun-28-2019, 04:16 PM
(This post was last modified: Jun-28-2019, 04:16 PM by m0ntecr1st0.)
There is a
Suppose need to write the phrase "Your location is
Writing a prepared phrase in templates is not an option. I need to do this through the admin panel. Using selects is also not an option, since the number of variables, their location and phrases are not known in advance. For example, the phrase "The capital of
I understand, need to create a
I'm use Django 1.11
City
model. It has a name
field. I need to somehow substitute this variable in the admin page in the text field at another models. Suppose need to write the phrase "Your location is
Paris
", but it is necessary that the name of the city was substituted by itself (since there are many cities, and prescribing for each is not an option at all). That is, there must be something like "Your location - {City.name}
" - that is, a certain city is pulled out of the database and substituted into this line. Writing a prepared phrase in templates is not an option. I need to do this through the admin panel. Using selects is also not an option, since the number of variables, their location and phrases are not known in advance. For example, the phrase "The capital of
France
- Paris
" (The capital of {Country.name}
- {City.name}
).I understand, need to create a
shortcode_name
field and somehow process it in the view?I'm use Django 1.11