#11079: Multi-table inheritance subclassed cannot be proxied -------------------------------------------------+-------------------------- Reporter: gsong | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Keywords: model proxy multi-table inheritance | Stage: Unreviewed Has_patch: 0 | -------------------------------------------------+-------------------------- Creating a proxy model for a multi-table inherited subclass fails. {{{ #!python class Place(models.Model): name = models.CharField(max_length=50)
class Restaurant(Place): genre = models.CharField(max_length=50) class PizzaJoint(Restaurant): class Meta: proxy = True >>> from proxy.models import Restaurant, PizzaJoint >>> Restaurant.objects.create(name='Greasy Pizza', genre='pizza') <Restaurant: Restaurant object> >>> Restaurant.objects.all() [<Restaurant: Restaurant object>] >>> PizzaJoint.objects.all() [] }}} Also when accessing `admin/proxy/pizzajoint/`, you get the following stack trace: {{{ Template error: In template e:\lehrhaus\django\django\contrib\admin\templates\admin\change_list.html, error at line 78 Caught an exception while rendering: 'NoneType' object has no attribute 'column' 68 : {% endif %} 69 : {% endblock %} 70 : 71 : <form action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}> 72 : {% if cl.formset %} 73 : {{ cl.formset.management_form }} 74 : {% endif %} 75 : 76 : {% block result_list %} 77 : {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %} 78 : {% result_list cl %} 79 : {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %} 80 : {% endblock %} 81 : {% block pagination %}{% pagination cl %}{% endblock %} 82 : </form> 83 : </div> 84 : </div> 85 : {% endblock %} 86 : Traceback: File "E:\lehrhaus\django\django\core\handlers\base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "E:\lehrhaus\django\django\contrib\admin\options.py" in wrapper 226. return self.admin_site.admin_view(view)(*args, **kwargs) File "E:\lehrhaus\django\django\contrib\admin\sites.py" in inner 184. return view(request, *args, **kwargs) File "E:\lehrhaus\django\django\contrib\admin\options.py" in changelist_view 984. ], context, context_instance=template.RequestContext(request)) File "E:\lehrhaus\django\django\shortcuts\__init__.py" in render_to_response 20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) File "E:\lehrhaus\django\django\template\loader.py" in render_to_string 108. return t.render(context_instance) File "E:\lehrhaus\django\django\template\__init__.py" in render 178. return self.nodelist.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 779. bits.append(self.render_node(node, context)) File "E:\lehrhaus\django\django\template\debug.py" in render_node 71. result = node.render(context) File "E:\lehrhaus\django\django\template\loader_tags.py" in render 97. return compiled_parent.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 178. return self.nodelist.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 779. bits.append(self.render_node(node, context)) File "E:\lehrhaus\django\django\template\debug.py" in render_node 71. result = node.render(context) File "E:\lehrhaus\django\django\template\loader_tags.py" in render 97. return compiled_parent.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 178. return self.nodelist.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 779. bits.append(self.render_node(node, context)) File "E:\lehrhaus\django\django\template\debug.py" in render_node 71. result = node.render(context) File "E:\lehrhaus\django\django\template\loader_tags.py" in render 24. result = self.nodelist.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 779. bits.append(self.render_node(node, context)) File "E:\lehrhaus\django\django\template\debug.py" in render_node 71. result = node.render(context) File "E:\lehrhaus\django\django\template\loader_tags.py" in render 24. result = self.nodelist.render(context) File "E:\lehrhaus\django\django\template\__init__.py" in render 779. bits.append(self.render_node(node, context)) File "E:\lehrhaus\django\django\template\debug.py" in render_node 81. raise wrapped Exception Type: TemplateSyntaxError at /admin/proxy/pizzajoint/ Exception Value: Caught an exception while rendering: 'NoneType' object has no attribute 'column' Original Traceback (most recent call last): File "E:\lehrhaus\django\django\template\debug.py", line 71, in render_node result = node.render(context) File "E:\lehrhaus\django\django\template\__init__.py", line 936, in render dict = func(*args) File "E:\lehrhaus\django\django\contrib\admin\templatetags\admin_list.py", line 251, in result_list return {'cl': cl, File "E:\lehrhaus\django\django\contrib\admin\templatetags\admin_list.py", line 247, in results for res in cl.result_list: File "E:\lehrhaus\django\django\db\models\query.py", line 93, in _result_iter self._fill_cache() File "E:\lehrhaus\django\django\db\models\query.py", line 660, in _fill_cache self._result_cache.append(self._iter.next()) File "E:\lehrhaus\django\django\db\models\query.py", line 207, in iterator for row in self.query.results_iter(): File "E:\lehrhaus\django\django\db\models\sql\query.py", line 287, in results_iter for rows in self.execute_sql(MULTI): File "E:\lehrhaus\django\django\db\models\sql\query.py", line 2336, in execute_sql sql, params = self.as_sql() File "E:\lehrhaus\django\django\db\models\sql\query.py", line 395, in as_sql self.pre_sql_setup() File "E:\lehrhaus\django\django\db\models\sql\query.py", line 587, in pre_sql_setup self.setup_inherited_models() File "E:\lehrhaus\django\django\db\models\sql\query.py", line 1311, in setup_inherited_models seen[model] = self.join((root_alias, model._meta.db_table, AttributeError: 'NoneType' object has no attribute 'column' }}} -- Ticket URL: <http://code.djangoproject.com/ticket/11079> Django <http://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 this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---