Re: Using foreignkey data as a primary key

2010-11-19 Thread fei
If you really want to have a separate table for Tag, You can do this: class CurrentTag(models.Model): tag = models.OneToOneField(Tag, primary_key=True) def __unicode__(self): return self.tag On Nov 20, 12:10 am, JE wrote: > Thanks for the replies. > I simplified the problem a bit

Re: Using foreignkey data as a primary key

2010-11-19 Thread JE
Thanks for the replies. I simplified the problem a bit by deciding it will be easier to have some extra validation code in a separate admin view to do what I need it to and removed the CurrentTag table, similar to what Rainy has said. On Nov 18, 4:59 pm, Rainy wrote: > On Nov 18, 9:04 am, JE wr

Re: Using foreignkey data as a primary key

2010-11-18 Thread Rainy
On Nov 18, 9:04 am, JE wrote: > Hi, > > I'm pretty new to Django so feel free to laugh if something's > horrendously wrong here that I haven't spotted. > > I'm trying to use a field from a foreign key as a primary key in > another model, but have no idea how to do this. > The idea is to have a t

Re: Using foreignkey data as a primary key

2010-11-18 Thread Jonas Geiregat
I myself am far from a django expert. But I think you should be using a ForeignKey Field. Because one Tag can be bound to more then one CurrentTag object, not ? Op 18-nov-2010, om 15:04 heeft JE het volgende geschreven: > class CurrentTag(models.Model): >tag = models.OneToOneField(Tag) > >

Using foreignkey data as a primary key

2010-11-18 Thread JE
Hi, I'm pretty new to Django so feel free to laugh if something's horrendously wrong here that I haven't spotted. I'm trying to use a field from a foreign key as a primary key in another model, but have no idea how to do this. The idea is to have a table called Tag (columns called tagname and tag