equal
deleted
inserted
replaced
1 from datetime import datetime |
1 from datetime import datetime |
2 from pytask.taskapp.models import Profile, Task, Comment, Claim, Map |
2 from pytask.taskapp.models import Profile, Task, Comment, Map |
3 from pytask.taskapp.utilities.task import getTask |
3 from pytask.taskapp.utilities.task import getTask |
4 from pytask.taskapp.utilities.request import create_request |
4 from pytask.taskapp.utilities.request import create_request |
5 from pytask.taskapp.utilities.helper import get_key |
5 from pytask.taskapp.utilities.helper import get_key |
6 from pytask.taskapp.utilities.notification import create_notification |
6 from pytask.taskapp.utilities.notification import create_notification |
7 |
7 |
139 and also update the claimed users field of the task. |
139 and also update the claimed users field of the task. |
140 """ |
140 """ |
141 |
141 |
142 task.claimed_users.add(user) |
142 task.claimed_users.add(user) |
143 task.save() |
143 task.save() |
144 claim = Claim() |
|
145 claim.message = message |
|
146 claim.task = task |
|
147 claim.user = user |
|
148 claim.creation_datetime = datetime.now() |
|
149 claim.save() |
|
150 |
144 |
151 pending_reqs = user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).all() |
145 pending_reqs = user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).all() |
152 for req in pending_reqs: |
146 for req in pending_reqs: |
153 req.is_valid = False |
147 req.is_valid = False |
154 req.save() |
148 req.save() |