Re: Bug with Foo.objects.get_or_create

2006-06-12 Thread m h
hmmm, it appears to sort of work with I add the .id attribute category. But on another object that also uses a foreign key, it won't work It still seems like a bug and is confusing. Why should the interface change on a convenience method? (I don't want to know about the id at all if I'm us

Re: Bug with Foo.objects.get_or_create

2006-06-12 Thread m h
Ticket 2144 On 6/12/06, Ian Holsman <[EMAIL PROTECTED]> wrote: > > Hi mh. > I had a similar issue, and my work around was to put the category > into the defaults section (as well) > > e2, created = Foo.objects.get_or_create(name=name, category=c, > defaults={ display_name=.., category=c } ) > > b

Re: Bug with Foo.objects.get_or_create

2006-06-12 Thread Ian Holsman
hmm.. I just checked my code and I use the 'id' fields obj, created = ObjectHourUserCounter.objects.get_or_create ( content_type__id__exact = ct_id, object_id = object.id, effective_date= this_hour, user__id__exact = user_id, session_key = session, defaults={'vie

Re: Bug with Foo.objects.get_or_create

2006-06-12 Thread m h
Ian- thanks for the swift response e , created = Foo.objects.get_or_create(name=name, category=c, display_name=dname, description=desc, homepage=home, logo_name="", small_logo_name="",defaults={"category":c}) fails with the same error I'll file a bug On 6/12/06, Ian Holsman <[EMAIL PROTEC

Re: Bug with Foo.objects.get_or_create

2006-06-12 Thread Ian Holsman
Hi mh. I had a similar issue, and my work around was to put the category into the defaults section (as well) e2, created = Foo.objects.get_or_create(name=name, category=c, defaults={ display_name=.., category=c } ) but you should probably raise a bug for this. regards Ian. On 13/06/2006, a

Bug with Foo.objects.get_or_create

2006-06-12 Thread m h
FYI... I'm having an issue with the get_or_create helper method. Apparently it isn't coercing parameters properly. I've got some code that looks like this: e = Foo(name=name, category=c, display_name=name.capitalize()) e2, created = Foo.objects.get_or_create(name=name, category=c, display_nam