Re: [Django] #25564: Django Admin's "View on Site" ignores model's custom manager

2015-10-23 Thread Django
#25564: Django Admin's "View on Site" ignores model's custom manager
-+-
 Reporter:  yuriiz   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:   |  Version:  1.8
  contrib.contenttypes   |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by yuriiz):

 I confirm, looks related.

--
Ticket URL: 
Django 
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/064.b04dfc5648eecfcf27fffa90be84b3a3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25564: Django Admin's "View on Site" ignores model's custom manager

2015-10-21 Thread Django
#25564: Django Admin's "View on Site" ignores model's custom manager
-+-
 Reporter:  yuriiz   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:   |  Version:  1.8
  contrib.contenttypes   |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * component:  Uncategorized => contrib.contenttypes
 * resolution:   => duplicate
 * type:  Uncategorized => Bug


--
Ticket URL: 
Django 
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/064.d22268d6705b9f7bce5133e985ff6c06%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25564: Django Admin's "View on Site" ignores model's custom manager

2015-10-17 Thread Django
#25564: Django Admin's "View on Site" ignores model's custom manager
---+--
 Reporter:  yuriiz |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  1.8
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Looks like a duplicate of #16281. Can you confirm?

--
Ticket URL: 
Django 
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/064.a21e8a3504c921dd9cbcfd310bf5d69b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #25564: Django Admin's "View on Site" ignores model's custom manager

2015-10-17 Thread Django
#25564: Django Admin's "View on Site" ignores model's custom manager
---+
 Reporter:  yuriiz |  Owner:  nobody
 Type:  Uncategorized  | Status:  new
Component:  Uncategorized  |Version:  1.8
 Severity:  Normal |   Keywords:
 Triage Stage:  Unreviewed |  Has patch:  0
Easy pickings:  0  |  UI/UX:  0
---+
 When there is model A located in DB other than default having custom
 manager and/or custom DB router to query appropriate database they both
 are ignored by django admin's "View on Site" feature. The problem indeed
 is deeper in content types get_object_for_this_type() implementation.
 Example source code:

 {{{
 class Manager(models.Manager):

 def get_queryset(self):
 return super(Manager, self).get_queryset().using('other')

 class A(models.Model):
 ...
 objects = Manager()

 class Router(object):

 def db_for_read(self, model, **hints):
 if isinstance(model, A):
 return 'other'

 def db_for_write(self, model, **hints):
 if isinstance(model, A):
 return 'other'

 }}}

 '''Current behaviour:''' with this setup clicking "View on Site" at model
 A's admin still results at "no such table: a" with traceback:
 {{{
 Request Method: GET
 Request URL: http://localhost:8000/admin/r/27/1432/

 Traceback:
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/core/handlers/base.py" in get_response
   132. response = wrapped_callback(request,
 *callback_args, **callback_kwargs)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/contrib/admin/sites.py" in wrapper
   254. return self.admin_view(view, cacheable)(*args,
 **kwargs)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/utils/decorators.py" in _wrapped_view
   110. response = view_func(request, *args, **kwargs)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/views/decorators/cache.py" in _wrapped_view_func
   57. response = view_func(request, *args, **kwargs)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/contrib/admin/sites.py" in inner
   233. return view(request, *args, **kwargs)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/contrib/contenttypes/views.py" in shortcut
   21. obj = content_type.get_object_for_this_type(pk=object_id)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/contrib/contenttypes/models.py" in
 get_object_for_this_type
   194. return
 self.model_class()._base_manager.using(self._state.db).get(**kwargs)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/models/query.py" in get
   328. num = len(clone)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/models/query.py" in __len__
   144. self._fetch_all()
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/models/query.py" in _fetch_all
   965. self._result_cache = list(self.iterator())
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/models/query.py" in iterator
   238. results = compiler.execute_sql()
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py" in execute_sql
   840. cursor.execute(sql, params)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/debug_toolbar/panels/sql/tracking.py" in execute
   159. return self._record(self.cursor.execute, sql, params)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/debug_toolbar/panels/sql/tracking.py" in _record
   101. return method(sql, params)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/backends/utils.py" in execute
   79. return super(CursorDebugWrapper, self).execute(sql,
 params)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/backends/utils.py" in execute
   64. return self.cursor.execute(sql, params)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/utils.py" in __exit__
   97. six.reraise(dj_exc_type, dj_exc_value, traceback)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/backends/utils.py" in execute
   64. return self.cursor.execute(sql, params)
 File "/home/i/frontend/local/lib/python2.7/site-
 packages/django/db/backends/sqlite3/base.py" in execute
   318. return Database.Cursor.execute(self, query, params)

 Exception Type: OperationalError at /admin/r/27/1432/
 Exception Value: no such table: categories

 }}}


 '''Expected behaviour:''' django admin and get_object_for_this_type()
 should use custom router / custom manager

--
Ticket URL: 
Django 
The W