Django Foreingkey limit_choices_to yerine formfield_for_foreignkey kullanmak
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "dc_layer":
kwargs["queryset"] = DataCenterLayers.objects.filter(datacenter_mission__mission_name='Firewall')
return super().formfield_for_foreignkey(db_field, request, **kwargs)
Django
hakkında diğer konular