Only set creator when creating task (#80)
* Only set creator when creating task * allow blank form input, use clean func to keep old val * remove unneeded created_date assignment * add test
This commit is contained in:
parent
7f576c9bc8
commit
2d40ef471e
7 changed files with 88 additions and 2 deletions
|
|
@ -49,6 +49,11 @@ class AddEditTaskForm(ModelForm):
|
|||
|
||||
note = forms.CharField(widget=forms.Textarea(), required=False)
|
||||
|
||||
def clean_created_by(self):
|
||||
"""Keep the existing created_by regardless of anything coming from the submitted form.
|
||||
If creating a new task, then created_by will be None, but we set it before saving."""
|
||||
return self.instance.created_by
|
||||
|
||||
class Meta:
|
||||
model = Task
|
||||
exclude = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue