2👍
✅
you need to custom the admin part in you app.
class VehicleAdmin(admin.ModelAdmin):
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "driver":
kwargs["queryset"] = Crew.objects.filter(isActive=True)
return super(VehicleAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
admin.site.register(Vehicle, VehicleAdmin)
Source:stackexchange.com