X
X

Select Your Currency

Türk Lirası $ US Dollar
X
X

Select Your Currency

Türk Lirası $ US Dollar
Yıllık Satın Alımlarda %15 İndirim: Şimdi Tasarruf Edin! Detaylı Bilgi İçin Tıklayın!

Knowledge Base

HomepageKnowledge BaseGeneralUsing formfield_for_foreignkey inst...

Using formfield_for_foreignkey instead of Django limit_choises_to

You can use the following commands to use formfield_for_foreignkey instead of Django Foreingkey limit_choices_to.

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)

Türkiye location You can click for our high-performance virtual servers.

Can't find the information you're looking for?

You have examined the knowledge base in detail, but if you cannot find the information you need,

Create a Support Ticket
Did you find it useful?
(77 times viewed. / 0 people found helpful.)