This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModelAdminForm(forms.ModelForm): | |
''' | |
To add the option 'Save as New', by default does not work for reverse | |
ManyToMany/ForeignKey fields. In other words, does not copy over the | |
reverse attributes. A simple workaround to make this happen is: | |
update the cleaned_data and returning it in the context. | |
Something like this: | |
''' | |
def clean(self, *args, **kwargs): | |
cd = self.cleaned_data |
NewerOlder