Hi all! I' m quite new to django. I googled a bit around but was not able to find an anser to my problem.
I have two models: class Patient(models.Model): ... many fields ... class Checkup(models.Model): ... many fields ... patient = models.ForeignKey(Patient, related_name='checkups') alcool = models.IntegerField(default=1) date = models.DateField() I define an admin model for Checkup because I want it inlined in Patient class CheckupInLineAdmin(admin.StackedInline): model = Checkup extra = 1 class PatientAdmin(admin.ModelAdmin): ... other fields... inlines = [ VisitaInLineAdmin, ] When I modify a Patient, I get the inline showing his/her checkups. Is there a way to pre-populate a field (alcool) when inserting a new inline Checkup, based on the value of the last inserted one? Let's suppose I have Patient John Doe. He did two checkups Checkup #1: date: 2012/01/01 alcool: 3 Checkup #2: date: 2012/02/02 alcool:2 I would like, when I modify John Doe through the admin interface, that the new empty inline Checkup shows a pre-populated value of 2 for the alcool field (the last inserted one for that patient) Currently I get 1, because i defined 1 as the default value How can I get this? Thanks, FraMazz -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/I4zC4PVk81IJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.