0

this is my first post here and im hoping to find a solution for my situation:

The thing is... I got a admin inline who show the relate info of a model. by this, i can see which contract_product belongs to current client.

When im creating a new object in the inline, aka click in the following button enter image description here

I cant see a list of option as follow: enter image description here

The problem is... the client must see only their products, but here i see all products for all type of clients?

PS: product and client has a direct relationship.

Hope someone can understand my problem and helps me!

Theres a kt if thing i've tried far now, but nothing succesful to talk about

  • Can you please provide your current code for the admin inline – SamSparx Dec 02 '22 at 06:13
  • https://stackoverflow.com/questions/69033260/filtering-django-admin-inline-limit-the-choices-list you might add this and benfit from it – Ahmad Akel Omar Dec 02 '22 at 07:27
  • I think Ahmed is right in his approach - adding the `formfield_for_foreignkey()` method to your ClientContractInline class . The relevant docs can be found here: https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey – SamSparx Dec 02 '22 at 21:41

0 Answers0