You can force database to watch after columns to be unique by one or in
combinations.
Django admin interface also can watch after this restrictions.
How to make a model to have few attributes unique together is described
here:
 http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together
So you make job and id to be unique together in shot model.

2008/9/24 paul <[EMAIL PROTECTED]>

>
> hi all,
>
> i've thrown myself into developing an animation pipeline using
> django.  i'm new to both python and django - but have in the (distant)
> past written thousands of lines of c,c++ & perl.  so, please be gentle
> - but maybe not too gentle with me.
>
> this first question is quite simple.  i have a job and shot classes
> (should i call them tables?).  each job has a unique name, and can
> have many shots attached to it.  a shot must have a unique name within
> each job.  ie,
>
> job=bmw, shot=1,2,3,looktest
> job=goldfrapp, shot=1,2,3,4,5,6,looktest,animtest
>
> currently, i'm using the admin UI to input job and shot information.
> my question is what is the best way to make sure that i never have a
> two shots of the same name per job?  should this logic be inserted
> into the save method of the shot, or could/should it be inserted
> elsewhere (ie, within the model itself)?
>
> sorry for the simplicity of the question - i'm still trying to get to
> grips with django/pythonific best practice...
>
> regards to all,
>
> paul
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to