Re: Unique Id's across several classes/tables
On 2/28/07, jzellman <[EMAIL PROTECTED]> wrote: > > Thanks for the reply. > > What I am trying to do is have subclasses. So this is what i would > like to do: > > class Parent(models.Model): > #stuff common to all child types > > class ChildA(Parent): > #... > > class ChildB(Parent): ># > > > i would like to have ids for ChildA and ChildB to be unique. > well, the easiest thing to do is handle it yourself, use your own sequence in the DB to generate the keys (assuming PostgreSQL) and assign the keys manually in save() method. or alter the id columns on the tables to use the same sequence > Thanks, > > Jeff > > > > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unique Id's across several classes/tables
Thanks for the reply. What I am trying to do is have subclasses. So this is what i would like to do: class Parent(models.Model): #stuff common to all child types class ChildA(Parent): #... class ChildB(Parent): # i would like to have ids for ChildA and ChildB to be unique. Thanks, Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unique Id's across several classes/tables
> Is it possible to have the ID field be unique across several classes > or tables? What i would like to do is, given the ID, load the object > of that type out of the database. Does this make sense, and is it > possible? No, it doesn't make sense <0.5 wink>, but here's how you might do it. You could create a ticket table whose sole purpose was to generate a unique id, then assign those ids as the primary keys to your tables. But someone can probably offer you a better approach if you can provide a description of your situation with more details. -- Jeff Bauer Rubicon, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Unique Id's across several classes/tables
Hi, Is it possible to have the ID field be unique across several classes or tables? What i would like to do is, given the ID, load the object of that type out of the database. Does this make sense, and is it possible? thanks, Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---