#26652: missing _default_manager in model instance
-------------------------------+--------------------
     Reporter:  rsalmaso       |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.10
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Given a model

 {{{#!python
 from django.db import models

 class Question(models.Model):
     question_text = models.CharField(max_length=200)
     pub_date = models.DateTimeField('date published')
 }}}

 In django < 1.10
 {{{#!python
 In [1]: from polls.models import Question

 In [2]: q = Question.objects.last()

 In [3]: Question._default_manager
 Out[3]: <django.db.models.manager.Manager at 0x7ff799637f28>

 In [4]: q._default_manager
 Out[4]: <django.db.models.manager.Manager at 0x7ff799637f28>
 }}}

 In django >= 1.10
 {{{#!python
 In [1]: from polls.models import Question

 In [2]: q = Question.objects.last()

 In [3]: Question._default_manager
 Out[3]: <django.db.models.manager.Manager at 0x7f5e0721d4a8>

 In [4]: q._default_manager
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)
 <ipython-input-4-2c5c6f28a506> in <module>()
 ----> 1 q._default_manager

 AttributeError: 'Question' object has no attribute '_default_manager'

 In [5]: q._meta.default_manager
 Out[5]: <django.db.models.manager.Manager at 0x7f5e0721d4a8>
 }}}

 It's an intenden behaviour?
 If so, it lacks a notice in releases note and/or manager docs.

 I found it testing my project with django-paypal
 (https://github.com/spookylukey/django-
 
paypal/blob/79b22278b658b2fc618771ca7c471ea398455147/paypal/standard/helpers.py#L24)

--
Ticket URL: <https://code.djangoproject.com/ticket/26652>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.aa4a75900ff50679d745a0e3dad2f42b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to