Setting custom SQL in django admin
Posted
by eugene y
on Stack Overflow
See other posts from Stack Overflow
or by eugene y
Published on 2010-06-09T20:48:22Z
Indexed on
2010/06/09
20:52 UTC
Read the original article
Hit count: 184
I'm trying to set up a proxy model in django admin. It will represent a subset of the original model. The code from models.py:
class MyManager(models.Manager):
def get_query_set(self):
return super(MyManager, self).get_query_set().filter(some_column='value')
class MyModel(OrigModel):
objects = MyManager()
class Meta:
proxy = True
Now instead of filter() I need to use a complex SELECT statement with JOINS. What's the proper way to inject it wholly to the custom manager?
© Stack Overflow or respective owner