Hi
how can i use smart_selects in multi inline i need in the admin django to select (Select Country) and show the cities of this country in inline (see pic)
i use :
smart_selects : django_smart_selects_711-1.0.0.dist-info
fieldsets_with_inlines : django_fieldsets_with_inlines-0.5
see picture to khnow what i need exactly
best regards
Just an idea from https://docs.djangoproject.com/en/3.0/ref/contrib/admin/
Please try out the following:
‘’’
class MyModelAdmin(admin.ModelAdmin):
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == “car”:
kwargs[“queryset”] = Car.objects.filter(owner=request.user)
return super().formfield_for_foreignkey(db_field, request, **kwargs)
‘’’