Friday, November 19, 2010

Re: Using foreignkey data as a primary key

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 <andrei....@gmail.com> wrote:
> On Nov 18, 9:04 am, JE <thegeni...@gmail.com> 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 table called Tag (columns called tagname and
> > tagversion, which create a composite primary key using the
> > unique_together option in the metadata).
>
> Why not just have a boolean column 'current' or 'active'
> in Tag model, instead of a separate table? On save,
> if it's changed inactive->active, all other tags are set
> to be inactive.  -ak

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate