Only set creator when creating task
This commit is contained in:
parent
21e0c6d656
commit
242067e46c
3 changed files with 2 additions and 1 deletions
|
@ -80,6 +80,7 @@ class Task(models.Model):
|
|||
null=True,
|
||||
related_name="todo_created_by",
|
||||
on_delete=models.CASCADE,
|
||||
editable=False,
|
||||
)
|
||||
assigned_to = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
|
||||
<input type="hidden" name="priority"
|
||||
value="{% if form.priority.value %}{{ form.priority.value }}{% else %}999{% endif %}" id="id_priority">
|
||||
<input type="hidden" name="created_by" value="{{ request.user.id }}" id="id_created_by">
|
||||
<input type="hidden" name="task_list" value="{{ form.task_list.value }}" id="id_task_list">
|
||||
|
||||
<p>
|
||||
|
|
|
@ -51,6 +51,7 @@ def list_detail(request, list_id=None, list_slug=None, view_completed=False) ->
|
|||
|
||||
if form.is_valid():
|
||||
new_task = form.save(commit=False)
|
||||
new_task.created_by = request.user
|
||||
new_task.created_date = timezone.now()
|
||||
new_task.note = bleach.clean(form.cleaned_data["note"], strip=True)
|
||||
form.save()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue