Much thanks to all.
I could not get something like:
gs=DinnerHost.objects.all().filter(complete()=True
to work. probably think fingers on my side to get the nomenclature
write; but I suspect not possible.
While I liked the idea of computing a new field "complete" in the
database which is
On Sun, Jan 16, 2011 at 6:51 AM, Mikhail Korobov wrote:
> It doesn't work that way. ORM translates you queries to SQL and the DB
> is responsible for filtering. It is not possible to translate
> arbitrary python function to SQL or pass it to DB engine. So you have
> to
try:
gs=DinnerHost.objects.all().filter(complete()=True
objects by default doesn't select anything, so either use
objects.get(pk=var_pk) or the a-typical case all().
-Matteius
On Jan 16, 7:04 am, rmschne wrote:
> Following is an extract of a Model I'm using. I'd like to be
Mikhail,
Thanks. I like that idea. Simple and understandable for those who
follow me.
On Jan 16, 2:51 pm, Mikhail Korobov wrote:
> It doesn't work that way. ORM translates you queries to SQL and the DB
> is responsible for filtering. It is not possible to translate
>
It doesn't work that way. ORM translates you queries to SQL and the DB
is responsible for filtering. It is not possible to translate
arbitrary python function to SQL or pass it to DB engine. So you have
to formulate you query using .filter syntax or raw SQL.
Another possibility is to denormalize
Thanks. I'm still messing with this; but don't think it quite what I'm
looking for.
I want/need the Model Definition function complete() for use at the
record level. I did this as a function since the rules are not based
simply on the value of the fields.
Ideally, I'd like to have the class
Hi,
On Jan 16, 1:04 pm, rmschne wrote:
> qs=DinnerHost.objects.filter(complete=True)
> and tried
> gs=DinnerHost.objects.filter(complete()=True
Try something along the lines of,
class DinnerHostManager(models.Manager):
def complete(self):
return self.filter(
Following is an extract of a Model I'm using. I'd like to be able to
query it to get a query set return that uses one of the Model
Definitions, e.g. get all the Hosts where "complete=True" where
'complete' is a model definition.
I know the nomenclature to use when exclude/include on a field in
8 matches
Mail list logo