Skip to content

Instantly share code, notes, and snippets.

@dizballanze
Created June 19, 2015 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dizballanze/807940a265572b158088 to your computer and use it in GitHub Desktop.
Save dizballanze/807940a265572b158088 to your computer and use it in GitHub Desktop.
class EditTaskForm(forms.ModelForm):
class Meta:
model = Task
fields = ('name', 'period', 'responsible')
exclude = ('at_project', )
def __init__(self, *args, **kwargs):
super(EditTaskForm, self).__init__(*args, **kwargs)
self.project = kwargs.get('project')
def save(self, **kwargs):
task = super(EditTaskForm, self).save()
task.at_project = self.project
task.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment