On Sat, Mar 27, 2010 at 2:54 AM, Kenneth Gonsalves wrote:
> thanks for the detailed reply - I now understand the issue. And yes, I did
> read the documentation, but did not absorb it properly.
A number of people have tripped over this sort of use of get_or_create;
there is an open ticket (#12579
thanks for the detailed reply - I now understand the issue. And yes, I did
read the documentation, but did not absorb it properly. Use of pyscopg1 is due
to inertia. When I was first using django I had a lot of legacy code using
psycopg1 and it was too much of a bother to migrate. That code is n
On Fri, Mar 26, 2010 at 1:49 AM, Kenneth Gonsalves wrote:
> Here is what I mean - A simple model with two fields, 'name' is unique,
> and 'num' is not null:
>
> >>> Tm.objects.get_or_create(name='me',num=1)
> (, True)
> >>> Tm.objects.get_or_create(name='me',num=2)
>
If you want get_or_create to
On Thursday 25 Mar 2010 9:17:12 pm Malcolm Tredinnick wrote:
> I don't understand what you are saying here. If the instance exists (as
> in, the filter parameters passed to get would return a single item),
> that instance is returned and the default parameters are never
> considered. So the values
On Thu, Mar 25, 2010 at 4:23 PM, Malcolm Tredinnick
wrote:
> No, he's not, because Kenneth said that the instance exists. In your
Actually, he described both situations where the instance exists, but
with different values for the non-key attributes of the model, and
where the instance doesn't exi
On Thu, 2010-03-25 at 15:58 +, Tom Evans wrote:
[...]
>
> He is describing this situation:
>
> >>> User.objects.get(username='tevans...@googlemail.com')
>
> >>> User.objects.get_or_create(username='tevans...@googlemail.com')
> (, False)
> >>> User.objects.get(username='tevans...@googlemail.c
On Thu, Mar 25, 2010 at 3:47 PM, Malcolm Tredinnick
wrote:
> On Thu, 2010-03-25 at 11:22 +0530, Kenneth Gonsalves wrote:
>> hi,
>>
>> I have a model like this:
>>
>> name - unique
>> slno - not null
>> mode - not null
>>
>> If the instance does not exist and I give all three values to get_or_creat
On Thu, 2010-03-25 at 11:22 +0530, Kenneth Gonsalves wrote:
> hi,
>
> I have a model like this:
>
> name - unique
> slno - not null
> mode - not null
>
> If the instance does not exist and I give all three values to get_or_create,
> it works
>
> if the instance exists, and I give values for sl
On Thu, Mar 25, 2010 at 10:29 AM, Daniel Roseman wrote:
>
> Actually the kwarg is 'defaults', not 'initial'.
>
> See
> http://docs.djangoproject.com/en/1.1/ref/models/querysets/#get-or-create-kwargs
> --
> DR.
>
Indeed :/
coffee++
Cheers
Tom
--
You received this message because you are subs
On Mar 25, 9:32 am, Tom Evans wrote:
> On Thu, Mar 25, 2010 at 5:52 AM, Kenneth Gonsalves wrote:
> > hi,
>
> > I have a model like this:
>
> > name - unique
> > slno - not null
> > mode - not null
>
> > If the instance does not exist and I give all three values to get_or_create,
> > it works
>
>
On Thu, Mar 25, 2010 at 5:52 AM, Kenneth Gonsalves wrote:
> hi,
>
> I have a model like this:
>
> name - unique
> slno - not null
> mode - not null
>
> If the instance does not exist and I give all three values to get_or_create,
> it works
>
> if the instance exists, and I give values for slno and
hi,
I have a model like this:
name - unique
slno - not null
mode - not null
If the instance does not exist and I give all three values to get_or_create,
it works
if the instance exists, and I give values for slno and mode which are different
from the existing ones - I get a programming error
12 matches
Mail list logo