On 2/28/07, Arvind Singh <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I wanted to use UUID as primary key in my models. Since Model doesn't
> have any add() method, I have to do it like this:
For the future - this question should be asked on the users list. The
developers list is for discussion of the development of Django itself.
That said: any reason you can't do:
m = MyModel(arg1=val, arg2=val)
m.arg3 = val
m.id = ''.join(str(uuid.uuid4()).split('-'))
m.save()
If the id already exists, you will overwrite the record; if it
doesn't, it will be created. This is the same behaviour as your
approach.
Yours,
Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---