V
V
Viktor Paperno2020-07-27 23:01:25
Django
Viktor Paperno, 2020-07-27 23:01:25

How to bind dropdown fields in Django (FOREIGN KEY)?

I have a model with two foreign keys.

I use this model inside a display that inherits from nested_admin.NestedTabularInline
How can I make it so that I can select the first value in the drop-down list in the admin panel, and then pull up the values ​​corresponding to the first from the database?

class Test(models.Model):
    field_a = models.ForeignKey("tmp.A",
                                   on_delete=models.CASCADE)
    field_b = models.ForeignKey("tmp.B",
                                   on_delete=models.CASCADE)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question