Commit Graph

77 Commits

Author SHA1 Message Date
Carl Meyer 6bdaef26ec Fixed #15866, #15850 -- Prevented get_model() and get_models() from returning not-installed models (by default). Thanks adsva for report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-20 17:58:37 +00:00
Karen Tracey 29341aaffc Fixed #13348: Restored ability to load models from apps in eggs. Thanks Ramiro and metzen for pointers on how to find out if a module loaded from an egg has a particular submodule.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-15 18:44:51 +00:00
Karen Tracey 48dd5f13a3 Fixed #13335: Adjusted the r12950 fix to properly handle import errors resulting from nested calls to load_app.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-14 19:10:27 +00:00
Karen Tracey 55c31fbdef Fixed #11696: Changed app loading code so that it does not swallow import errors that used to be (prior to r10088) raised.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-12 12:39:18 +00:00
Adrian Holovaty 5ceed0a053 Changed a whole bunch of places to raise exception instances instead of old-style raising exception classes plus a comma. Good for the future Python 3 conversion
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:36:20 +00:00
Russell Keith-Magee 3d00992d9f Fixed #11936 -- Removed deferred models from the list returned by the app_cache. Thanks to ryszard for the report, and clamothe for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 06:01:23 +00:00
Luke Plant b38e678dae Fixed #12389 - performance enhancement of get_models()
Thanks to Travis Cline for the patch, which gives about 35% speed increase
for the testsuite (with SQLite in-memory DB).



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16 21:25:00 +00:00
Russell Keith-Magee 585b7acaa3 Fixed #10109 -- Removed the use of raw SQL in many-to-many fields by introducing an autogenerated through model.
This is the first part of Alex Gaynor's GSoC project to add Multi-db support to Django.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11710 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03 14:02:49 +00:00
Jacob Kaplan-Moss c485e236bd Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 16:55:59 +00:00
Luke Plant 7c621535a2 Added tests for corner case with deleting where objects are deleted in the wrong order.
These tests currently fail, by design, fix will be committed shortly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-21 20:55:17 +00:00
Russell Keith-Magee e829e9ff8f Fixed #7044 -- Corrected a minor typo in a docstring in the model loader. Thanks, msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-17 13:58:19 +00:00
Russell Keith-Magee 12146f34fd Removed code that was recasting major errors found during application import. If an application can't be imported, it now throws a full stack trace with the problem, rather than reporting the problem as a one line message.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6087 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-10 07:00:46 +00:00
Malcolm Tredinnick 7969c1ba05 Renamed Cache to AppCache and cache_ready() to app_cache_ready() from [5919] in order to avoid any potential confusion with Django's caching middleware functionality when reading the code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-18 04:16:04 +00:00
Malcolm Tredinnick 3219a60167 Rewrote portions of the app- and model-cache initialisation to handle some corner cases. It is now possible to use m2m relations before everything is imported and still get the right results later when importing is complete. Also, get_apps() should always return the same results, so apps won't randomly disappear in the admin interface.
Also reorganised the structure of loading.py, since the number of global variables was exploding. The public API is still backwards compatible.

Fixed #1796 and #2438 (he claims, optimistically).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5919 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-17 17:23:15 +00:00
Malcolm Tredinnick 439cb4047f Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary
Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 13:30:48 +00:00
Adrian Holovaty 41d11a685f Fixed #2968 -- Changed arguments to __import__ to use empty dictionary instead of empty string, for stricter compliance with Python library reference. Thanks for the patch, Yasushi Masuda
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-30 20:50:27 +00:00
Adrian Holovaty d9d44d718b Negligible style change in django.db.models.loading
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-08 21:17:59 +00:00
Malcolm Tredinnick 9e957485bd Seed the global app cache in a call to db.models.get_model() except when we are
constructing a model class. Refs #2348.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3490 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-29 21:04:41 +00:00
Adrian Holovaty 127a3f002d Negligible spacing change to django/db/models/loading.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3243 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-30 19:13:00 +00:00
Malcolm Tredinnick d6c95e93a7 Fixed #1812 -- permit apps without models (without disguising other errors).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-28 01:53:30 +00:00
Malcolm Tredinnick 919df8b8c7 Fixed another path where imports were creating two instances of a model's
class. Refs #1796, #2232.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3212 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-26 16:20:58 +00:00
Malcolm Tredinnick db366b4a78 Fixed #1796 -- implemented more robust normalisation for module filenames
before comparing them. Ivan Saglaev found a case where r3202 did not work
properly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-26 09:01:07 +00:00
Malcolm Tredinnick fd702fe034 Fixed #1796 -- only load a single copy of each model, even when it is
referenced via different import paths. Solves a problem with many-to-many
relations being set up incorrectly. Thanks to Curtis Thompson, Luke Plant and
Simon Willison for some excellent debugging of the problem. Refs #2232 (may
also have fixed that).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-25 14:49:34 +00:00
Russell Keith-Magee 23c24fc08b Fixes #1812 -- Added model validity checks to ensure that models.py exists, and has been successfully imported for all INSTALLED_APPS. Previous behaviour was to silently ignore empty/problem models, which resulted in the display of an admin page that doesn't display a supposedly installed model. Thanks to Ian Holsman for the original report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3201 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-25 04:24:15 +00:00
Russell Keith-Magee 0d4b5b9b4a Fixed #1662 -- Added resolver for string-form model references for models that have already been loaded, with tests to validate both forward and backward referenced model names. Light refactoring of model loading to make regression tests behave more like normal model loading. Also clarifies the text of some validation errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3195 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-23 04:37:00 +00:00
Adrian Holovaty c21acb6aeb Fixed #1732 -- AttributeErrors in models are no longer ignored by the model validator.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 19:28:55 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00