﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20314	provide a management command to database views to cover inheritance	chris@…	nobody	"if you use inheritance like this:

{{{
class Foo(models.Model):
  a = models.CharField(max_length=10)

class Bar(Foo):
  b = models.CharField(max_length=10)
}}}

That will lead to two tables being created:

{{{
create table myapp_foo(id int, a varchar(10));
create table myapp_bar(foo_id, b varchar(10));
}}}

That's great.  But when I need to run queries directly against the database, I have to write all the joins myself.  Since I'm (extraordinarily) lazy, I would love to see a new management command that creates a view like this:

{{{
create view bar_view as -- i hate that name, but it's good for an example
select *                -- if I did this for real, I would enumerate the columns
from myapp_foo
join myapp_bar on myapp_foo.id = myapp_bar.foo_id
}}}

for this trivial example, the typing isn't that much.  But when you get deep inheritance hierachies, the typing becomes a pain (especially since the name of the ""id"" key keeps changing at each level)."	New feature	closed	Database layer (models, ORM)	1.5	Normal	wontfix			Unreviewed	0	0	0	0	0	0
