On Tue, Aug 28, 2012 at 7:20 PM, Jill Green <jill.greenish@gmail.com> wrote:
I hope someone has come across this problem before because it's driving me nuts. Basically I have a model, Partner and it has a PartnerAdmin page. Inside the partner I have another model called Data that is an Inline to the Partner. I used the model.ForeignKey in the Data to reference it back to the Partner instance. What I want to do is everytime I create a new Partner and click to save it to automatically create one Data object (sort of a requirement) for all new partners. It currently looks like this:PartnerAdmin:#stuffinlines = ['DataInline',]Data:name= model.Char#more stuffDataInline(admin.TabularInline):extra = 0form = DataFormformset = DataFormSetI have tried using the initial data and trying to bind a form from it but it won't work. Please any help would be appreciated.
Maybe implementing the save_model method at PartnerAdmin can do the trick.
Here is the doc :
You should use the change parameter to check if it's a new object or not.
--
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/-/YvGlPmf_HtEJ.
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.
Nicolas Emiliani
Lo unico instantaneo en la vida es el cafe, y es bien feo.
--
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.
No comments:
Post a Comment