Use of raw queries - proposal
Using [[https://docs.djangoproject.com/en/1.2/topics/db/sql/#executing-custom-sql-directly|raw queries]] for reading livesettings can solve several areas of problems:
Livesettings can not be much easy and reliably used from models.
The first problem is cascade of dependencies of imports. (Nothing with data in the database is be done before all models are imported.) \
- The second problem is an internal validation of models, which enumerates all choices and stores their values in the memory before startng anything. It is possible to use them for choice attribute only, if it is implemented as iterator function. \
some comments in the related issue <<issue 26>>: "Access settings from model"
Livesettings can not be easy and reliably used from urls. A small bug or complicated import dependency in any db model can produce a problem in initial url config validation. The reported url usually does not relate to the problem.
It is better to do rollback before syncdb, if the table for livesettings does not exist, than to try access db values inside syncdb and do rollback inside syncdb.
It is all much more complicated by tests (manage.py test) because all urls are first evaluated with the normal database. Then the connection is replaced by an empty test database, internal syncdb is done and tests are run. Also model validation is done more times. This will be not solved but hopefully simplified.
Excuse me that I wrote it with inaccuracy and without any reference to source code. I have studied problems in depth several months ago. If you disagree with something, I can try to verify it.
Do you thing it is good idea? +pros -cons? \ (If so I would do a test branch and I would cooperate more with Craig #24: heaps of fixes)