Hi,

I would like to modify an attribute on a model based on the other 
attributes when it is added from the admin or elsewhere.

For example:

    Model A: 
    has FK to Model B
    has FK to Model C
    
    Model B: 
    has FK to Model C


When I create a Model A, I choose a Model B so I'd like the FK to Model C 
to be set automatically based on the FK to Model C that already exists on 
Model B.

I found the ``Model.clean`` method 
(https://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.clean)
 
but it says that it is not invoked when you call your model’s save() method 
so when is it invoked? I am a bit confused about the purpose of this method 
then.

I tried the clean method and I was able to make it work after some issues 
but I am wondering whether that's the best way to do it?

Thanks
Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/72e88e1d-3ed5-4a81-8ee2-4f3b724552dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to