On Tue, Jul 7, 2015 at 4:31 PM, Carlos Andre <eucan...@gmail.com> wrote: > I want copy some values to other fields in other table! >
That's fine, although I would only recommend doing so if the qtdade in Person and 'value' field in Contact can contain different data in some scenario. You will still need to set a static default (ie default='') in the model definition and override the save() method to do the copy, though: # This is a bit naive and assumes that p always contains a Person object. Add validation and/or business logic accordingly. def save(self, *args, **kwargs): # If no PK, we know this is a new object and that value hasn't been set if not self.pk: self.value = self.p.qtdade super(Contact, self).save(*args, **kwargs) # Call the "real" save() method. If they will always be the same, I would recommend keeping the approach that I sent out originally, and in addition, adding a property or model method to retrieve that data in the Contact class. -James -- 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/CA%2Be%2BciUvhkGdZyh97cqRxAyxk%2BiPcwTqmAL2_bHussp-gCSOTA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.