#19384: Managers can no longer be used on abstract models -------------------------------+-------------------- Reporter: mhsparks | Owner: nobody Type: Uncategorized | Status: new Component: Uncategorized | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- Given the (contrived) models.py
{{{ from django.db import models class ChoiceManager(models.Manager): def get_first_choice(self): return Choice1 class Choice(models.Model): choice = models.CharField(max_length=200) votes = models.IntegerField() choices = ChoiceManager() class Meta: abstract = True class Choice1(Choice): pass class Choice2(Choice): pass }}} I get the following error when trying to access models.Choice.choices.get_first_choice() using 1.5 (master). {{{ Traceback (most recent call last): File "/home/mark/venvs/django-14/abstract_managers/demo/tests.py", line 20, in test_abstract_manager models.Choice.choices.get_first_choice() File "/home/mark/venvs/django-15/src/django/django/db/models/manager.py", line 244, in __get__ self.model._meta.object_name, AttributeError: Manager isn't available; Choice is abstract }}} The code runs fine under 1.4. It appears that this behaviour was changed with this commit: https://github.com/django/django/commit/cc337a74f1808b216fff96f1695d8b066d2636f6 Relating to this ticket: https://code.djangoproject.com/ticket/19069 -- Ticket URL: <https://code.djangoproject.com/ticket/19384> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.