[Answered ]-Django admin cache m2m relation

1👍

You can use raw_id_fields

class CompanyAdmin(admin.ModelAdmin):
    raw_id_fields = ("cities",)

1👍

23000 is actually “nothing” for a database.

First, you need to identify the “culprit” of a slowdown, which query is slow. This is where django-debug-toolbar would help a lot. Then, you can run the queries manually with EXPLAIN and see what can be improved – for example, adding indexes could help.

Also, consider using django-cache-machine or johnny-cache packages.

Also see:

👤alecxe

Leave a comment