#26401: Allow auth machinery to be used without installing auth app -------------------------------------+------------------------------------- Reporter: Matt Johnson | Owner: Andrew | Konoff Type: Bug | Status: closed Component: contrib.auth | Version: 1.9 Severity: Normal | Resolution: fixed Keywords: auth | Triage Stage: Ready for | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Jon Dufresne): I've hit another snag with the `MIGRATION_MODULES = {'auth': None}` approach. (Sorry, is it better to reopen this ticket or file a new one?) The `auth.Permission` model has a fk on `ContentType`. Due to this, when deleting a `ContentType` (such as with the `remove_stale_contenttypes` command) queries against the missing `auth_permission` table can occur. Not sure how best to handle this scenario. IIUC, as long as auth is in `INSTALLED_APPS`, the models will be loaded and this FK will cause an issue. Here is a stack trace when deleting a stale content type {{{ Traceback (most recent call last): File "/usr/lib64/python3.5/runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "/usr/lib64/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/jon/devel/django/django/__main__.py", line 9, in <module> management.execute_from_command_line() File "/home/jon/devel/django/django/core/management/__init__.py", line 366, in execute_from_command_line utility.execute() File "/home/jon/devel/django/django/core/management/__init__.py", line 358, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/jon/devel/django/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/home/jon/devel/django/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/home/jon/devel/django/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py", line 46, in handle collector.collect([ct]) File "/home/jon/devel/django/django/db/models/deletion.py", line 218, in collect elif sub_objs: File "/home/jon/devel/django/django/db/models/query.py", line 260, in __bool__ self._fetch_all() File "/home/jon/devel/django/django/db/models/query.py", line 1072, in _fetch_all self._result_cache = list(self.iterator()) File "/home/jon/devel/django/django/db/models/query.py", line 54, in __iter__ results = compiler.execute_sql() File "/home/jon/devel/django/django/db/models/sql/compiler.py", line 847, in execute_sql cursor.execute(sql, params) File "/home/jon/devel/django/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/jon/devel/django/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/home/jon/devel/django/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) File "/home/jon/devel/django/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/jon/devel/django/django/db/backends/sqlite3/base.py", line 334, in execute return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such table: auth_permission }}} -- Ticket URL: <https://code.djangoproject.com/ticket/26401#comment:19> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.133c0faeea597d220ca22352c6932796%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.