Skip to content

Commit

Permalink
Add todo required field (#791)
Browse files Browse the repository at this point in the history
* Add todo required field

* Fix tests

* Update comment

* Update the comment
  • Loading branch information
junusheva committed Jul 27, 2021
1 parent 1699ae7 commit 82c7d8b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
18 changes: 18 additions & 0 deletions orchestra/migrations/0096_todo_required.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.13 on 2021-07-26 09:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('orchestra', '0095_todo_slug'),
]

operations = [
migrations.AddField(
model_name='todo',
name='required',
field=models.BooleanField(default=False),
),
]
3 changes: 3 additions & 0 deletions orchestra/models/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ class Todo(TodoMixin, BaseModel):
A unique identifier for each todo list item.
It is used to refer and retrieve specific
to-do items.
required (boolean):
Whether the todo is required.
Constraints:
Expand Down Expand Up @@ -800,6 +802,7 @@ class Status(ChoicesEnum):
default=Status.PENDING.value, choices=Status.choices())
additional_data = JSONField(default=dict)
slug = models.CharField(max_length=255, null=True, blank=True)
required = models.BooleanField(default=False)


class TodoQA(TodoQAMixin, BaseModel):
Expand Down
5 changes: 3 additions & 2 deletions orchestra/tests/test_todos.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _todo_data(title, status=Todo.Status.PENDING.value,
due=None, parent_todo=None, template=None,
activity_log=str({'actions': []}), qa=None,
project=None, step=None, details=None, is_deleted=False,
slug=None):
slug=None, required=False):
return {
'title': title,
'template': template,
Expand All @@ -58,7 +58,8 @@ def _todo_data(title, status=Todo.Status.PENDING.value,
'step': step,
'slug': slug,
'details': details,
'is_deleted': is_deleted
'is_deleted': is_deleted,
'required': required
}


Expand Down
1 change: 1 addition & 0 deletions orchestra/todos/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class Meta:
'order',
'status',
'additional_data',
'required',
'is_deleted')
read_only_fields = ('id',)
list_serializer_class = TodoBulkCreateListSerializer
Expand Down

0 comments on commit 82c7d8b

Please sign in to comment.