Python Forum
Django: How to automatically substitute a variable in the admin page at Django 1.11?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django: How to automatically substitute a variable in the admin page at Django 1.11?
#1
There is a 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
Reply


Messages In This Thread
Django: How to automatically substitute a variable in the admin page at Django 1.11? - by m0ntecr1st0 - Jun-28-2019, 04:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  For loop in Django Sowmya 1 272 Apr-17-2024, 08:53 AM
Last Post: Abhishikt
  Order by Django Sowmya 1 239 Apr-17-2024, 08:52 AM
Last Post: Abhishikt
  Birçoğundan çoğuna Django wamp sunucusunda çalışmıyor TMSUT 2 636 Apr-01-2024, 07:27 AM
Last Post: tosserunamused
  view option in Django Sowmya 1 304 Mar-29-2024, 12:41 PM
Last Post: SULMAN
  context Django Sowmya 0 212 Mar-22-2024, 10:47 AM
Last Post: Sowmya
  CRUD in Update operation in Django Sowmya 2 339 Mar-19-2024, 04:14 AM
Last Post: Sowmya
  Python django view error ZeeKolachi 1 357 Mar-18-2024, 03:14 PM
Last Post: Sowmya
  Document on Django Sowmya 0 237 Mar-18-2024, 03:02 PM
Last Post: Sowmya
  Bootstrap Django Sowmya 0 219 Mar-16-2024, 09:22 AM
Last Post: Sowmya
  Fetching Images from DB in Django Dexty 2 1,722 Mar-15-2024, 08:43 AM
Last Post: firn100

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020