Re: How to create Union in Django queryset

2014-04-17 Thread Simon Charette
I'm not sure this will work but you could try creating a VIEW on the database side that does the union there and access it through an un-managed model. CREATE VIEW *view_name* AS SELECT id, name FROM *a* UNION SELECT id, name FROM *b*; class C(models.Model): name = models.CharField()

Re: How to create Union in Django queryset

2014-04-17 Thread Thomas Lockhart
On 4/16/14 11:51 PM, Shoaib Ijaz wrote: I don't want use SQL query in django OK. You *could* have class B inherit from class A: class B(A): link = models.IntegerField(blank=True, null=True) and then do your query on A: ulist = A.objects.all() hth - Tom On

Re: How to create Union in Django queryset

2014-04-17 Thread Shoaib Ijaz
I don't want use SQL query in django On Thursday, 17 April 2014 04:39:09 UTC+5, Russell Keith-Magee wrote: > > On Wed, Apr 16, 2014 at 9:30 PM, Shoaib Ijaz > > wrote: > > Sorry for duplicate post How to create Union > > > > I am using Django REST Framework in project

Re: How to create Union in Django queryset

2014-04-16 Thread Russell Keith-Magee
On Wed, Apr 16, 2014 at 9:30 PM, Shoaib Ijaz wrote: > Sorry for duplicate post How to create Union > > I am using Django REST Framework in project and I want to create union two > different Models. > > My Models > > class A(models.Model): > name =

How to create Union in Django queryset

2014-04-16 Thread Shoaib Ijaz
Sorry for duplicate post How to create Union<http://stackoverflow.com/questions/23110658/how-to-create-union-in-django-queryset> I am using Django REST Framework in project and I want to create union two different Models. *My Models* class A(models.Model): name = models.Cha