Let's take the admin changelist as an example again. I have a changelist just like this. Let me give a sequence of steps:
1. User1 and User2 both have the changelist displayed on their screen, and both are displaying objects A and B. Let's say the objects have a 'name' field, and objectA's name field is set to 'A', and objectB's name field is set to B 2. User1 sets objectA's 'name' field to 'foo', then saves 3. User2 is still looking at his view of the changelis and still sees objectA's name field with the value 'A' (ie, User2 has not refreshed) User2 now sets objectB's name field to 'bar', and saves. In this scenario, when User2's save happens (#3), I need to make sure that the save does not overwrite objectA's name field with 'A'. For each form in the changelist, I need to identify what has changed in the form, and then save only those fields. I did this through a couple mechanisms: 1. I use hidden_initial and always send the initial data with the form 2. When processing a POST, for each field in the form, I compare hidden initial to the data sent by the user (I simply use changed_data(), as this works with hidden_initial). If the data for a field has changed, then I want to save that field. If it hasn't, I don't. On a form by form basis, I set exclude, just prior to calling save, to cause it to save the right fields. I think to do this only using self.fields, I would have to create two forms for each item in the changelist. I would first have to create a form that has all of the fields, then identify which fields have changed, then based on that, create a new form containing just those fields. Or I could of course just not use ModelForms, and use a non- model Form and do all the save logic myself. But setting exclude prior to the save really worked beautifully. I would think the changelist could benefit from this paradigm as well. Margie On Jul 13, 5:41 am, SmileyChris <smileych...@gmail.com> wrote: > On Jul 13, 9:10 pm, Margie <margierogin...@gmail.com> wrote: > > > Yes, I know from tickets I have posted that modifying exclude > > dynamically is "not allowed". > > Why wouldn't you just modify self.fields? -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.