I'm trying to change the way to load models on the admin page, especially foreign keys, because I have a delay to load them, the option for this was to exclude the field, but I want to have another option, thanks
# model.service.py
class Service(BaseModel):
# Service data
client = models.ForeignKey(Client, on_delete=models.CASCADE, null=True)
Any = models.CharField()...
# service_form.py
class ServiceForm(forms.ModelForm):
class Meta:
model = models.Service
exclude = ["client"]
# admin.py
class serviceAdmin(admin.ModelAdmin):
model = models.service
admin.site.register(models.service, ServiceAdmin)
this way I exclude the field for loading, but is there a way to do it that doesn't take so long to load?