Django Admin Filter if exist then exclude those items
I need to filter out with this query so that I do not have to see every item all over the World, if I could query with country-specific and will see only country-specific , I need help on this
admin.py
def formfield_for_manytomany(self, db_field, request, **kwargs):
if db_field.name == "item_name":
kwargs["queryset"] = models.ItemList.objects.fliter(countries__in=[request._user_country]).exclude(countries__in=[request._user_country])
return super().formfield_for_foreignkey(db_field, request, **kwargs)