Re: models created from database table

2009-02-04 Thread Karen Tracey
On Thu, Feb 5, 2009 at 1:19 AM, Waruna de Silva wrote:

> Thanks
>
> What is the best possible way to handle that type of a problem
>
>
I don't know, it is not something I've ever needed.  If you Google
"composite primary keys" and Django you'll get hits that point to the ticket
where the feature is requested and various conversations on the development
list, etc.  Perhaps you can find some useful hints in those sources.

Karen

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: models created from database table

2009-02-04 Thread Waruna de Silva
Thanks

What is the best possible way to handle that type of a problem

On Thu, Feb 5, 2009 at 11:45 AM, Karen Tracey  wrote:

> On Thu, Feb 5, 2009 at 12:58 AM, Waruna de Silva wrote:
>
>> Thanks Ramior for info
>>
>> In Models is it possible to name to Fields as primary keys
>>
>> as exmaple, there are two fields
>> gid = models.IntegerField()
>> business_id = models.ForeignKey(Business)
>>
>> how to make both of them as primary keys , following isn't work
>> gid = models.IntegerField(primary_key=True)
>> business_id = models.ForeignKey(Business, primary_key=True)
>>
>
>
> No, you cannot do this at present.  Composite primary keys may be supported
> at some point, but they are not now.
>
> Karen
>
>
>
>>
>>
>>
>> On Tue, Feb 3, 2009 at 5:05 PM, Ramiro Morales  wrote:
>>
>>>
>>> On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva 
>>> wrote:
>>> > Hi,
>>> >
>>> > In Django is it possible to created models automatically from
>>> > existing database.
>>>
>>> Yes, see
>>>
>>>
>>> http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases
>>>
>>> --
>>>  Ramiro Morales
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: models created from database table

2009-02-04 Thread Karen Tracey
On Thu, Feb 5, 2009 at 12:58 AM, Waruna de Silva wrote:

> Thanks Ramior for info
>
> In Models is it possible to name to Fields as primary keys
>
> as exmaple, there are two fields
> gid = models.IntegerField()
> business_id = models.ForeignKey(Business)
>
> how to make both of them as primary keys , following isn't work
> gid = models.IntegerField(primary_key=True)
> business_id = models.ForeignKey(Business, primary_key=True)
>


No, you cannot do this at present.  Composite primary keys may be supported
at some point, but they are not now.

Karen



>
>
>
> On Tue, Feb 3, 2009 at 5:05 PM, Ramiro Morales  wrote:
>
>>
>> On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva 
>> wrote:
>> > Hi,
>> >
>> > In Django is it possible to created models automatically from
>> > existing database.
>>
>> Yes, see
>>
>>
>> http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases
>>
>> --
>>  Ramiro Morales
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: models created from database table

2009-02-04 Thread Waruna de Silva
Thanks Ramior for info

In Models is it possible to name to Fields as primary keys

as exmaple, there are two fields
gid = models.IntegerField()
business_id = models.ForeignKey(Business)

how to make both of them as primary keys , following isn't work
gid = models.IntegerField(primary_key=True)
business_id = models.ForeignKey(Business, primary_key=True)

regards,
Waruna


On Tue, Feb 3, 2009 at 5:05 PM, Ramiro Morales  wrote:

>
> On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva 
> wrote:
> > Hi,
> >
> > In Django is it possible to created models automatically from
> > existing database.
>
> Yes, see
>
>
> http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases
>
> --
>  Ramiro Morales
>
> >
>

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: models created from database table

2009-02-03 Thread Ramiro Morales

On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva  wrote:
> Hi,
>
> In Django is it possible to created models automatically from
> existing database.

Yes, see

http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



models created from database table

2009-02-03 Thread Waruna de Silva
Hi,

In Django is it possible to created models automatically from
existing database.

Thanks
Waruna

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---