django_reverse_admin icon indicating copy to clipboard operation
django_reverse_admin copied to clipboard

Is it possible to display the standard select dropdown for foreign key

Open hotdev405 opened this issue 4 years ago • 3 comments

I am working on a ticketing system.

` class Customer(models.Model): name = models.CharField() address email, etc

class Ticket(): customer = models.ForeignKey(Customer)

`

In django admin, i would like to have both the possibilities to either select an existing customer or to enter new customer data along with ticket data. How can i achieve this ?

Thank you

hotdev405 avatar Jul 06 '20 21:07 hotdev405

I think you will be better off using just a regular inline. Please see screenshot here - https://github.com/daniyalzade/django_reverse_admin/raw/master/images/admin_without_reverse_inline.png

Regular inline would allow you to select existing customer, or create a new customer in a separate pop up and select that customer. Does that not work?

daniyalzade avatar Jul 11 '20 19:07 daniyalzade

What can be done today is to delete the associated object and recreate a new one, but not select an existing one.

I believe this could become a future feature. But today it is not possible to do so.

gutierri avatar May 03 '24 13:05 gutierri

I miss this feature too. When an existing object is already referenced, I like having all the FK fields editable in the change view. When adding a new one, I'd like a dropdown (or a select2) to select an existing FK record.

Am I right in saying that right now you can't use the admin to create a new record that points to existing FK records, while using the reverse inlines?

intrepidclass avatar Jul 12 '24 17:07 intrepidclass