8👍
That’s a very inefficient solution because you dereference site and region, causing lots and lots of queries. This will not scale beyond maybe 100 events in your DB.
The best solution is to denormalize your data by copying e.g. the region’s id into Event on save(). Then you can directly do Event.objects.filter(region_id=regionID). The resulting code becomes less clean and maintainable, but that’s the way things work on non-relational DBs, today.
All I can say right now is: Wait until the end of January if you can. 😉
1👍
January has gone and dbindexer now supports simple JOINS. You can read about here: http://www.allbuttonspressed.com/blog/django/joins-for-nosql-databases-via-django-dbindexer-first-steps
If you are already using dbindexer you should simply register your index using something like this:
# photo/dbindexes.py:
from models import Event
from dbindexer.lookups import StandardLookup
from dbindexer.api import register_index
register_index(Event, {'site__region': StandardLookup(),})
- [Django]-Django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured
- [Django]-Django – Prevent automatic related table fetch
- [Django]-How to solve "No Python interpreter configured for the module"? in Android Studio?
- [Django]-NoReverseMatch in django production server