Created
April 12, 2013 15:19
-
-
Save george-silva/5372806 to your computer and use it in GitHub Desktop.
foda
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 FormFoda(forms.ModelForm): | |
def __init__(self, usuario, campo, *args, **kwargs): | |
self.usuario = usuario | |
self.campo = campo | |
super(FormFoda, self).__init__(*args,**kwargs ) | |
def save(self, commit=True): | |
if hasattr(self.instance, self.campo): | |
setattr(self.instance, self.campo, self.usuario) | |
return super(FormFoda, self).save(commit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment