We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fsm_log_by
by
model:
@fsm_log_by @transition(field=status, source=Status.PENDING_CODE_REVIEW.name, target=Status.CODE_REJECTED.name) def reject_code(self, by=None): print('REJECTING...') print(by.id) pass
(Successfully prints user's id but doesn't persist by to StateLog)
id
views.py:
def post(self, request, job_id): job = get_object_or_404(Job, pk=job_id) if not can_proceed(job.reject_code): raise PermissionDenied job.reject_code(self.request.user) job.save()
DB:
postgres=# select * from django_fsm_log_statelog; id | timestamp | state | transition | object_id | by_id | content_type_id ----+-------------------------------+---------------+--------------+-----------+-------+----------------- 1 | 2018-02-06 14:40:30.159429+00 | QUEUED | approve_code | 2 | | 1 2 | 2018-02-06 14:58:45.591487+00 | DELETED | delete | 1 | | 1 3 | 2018-02-06 15:28:10.691508+00 | QUEUED | approve_code | 3 | | 1 4 | 2018-02-07 14:08:30.8747+00 | CODE_REJECTED | reject_code | 4 | | 1 5 | 2018-02-07 14:09:42.174577+00 | CODE_REJECTED | reject_code | 5 | | 1 6 | 2018-02-07 14:32:12.451424+00 | CODE_REJECTED | reject_code | 6 | | 1 (6 rows)
REPL:
>>> StateLog.objects.get(pk=6).by >>> StateLog.objects.get(pk=6).by_id
This is with the latest pip release, 1.5.0
The text was updated successfully, but these errors were encountered:
Found my obvious rookie mistake -- passing in the user as an arg rather than kwarg.
Fix: job.reject_code(self.request.user) -> job.reject_code(by=self.request.user)
job.reject_code(self.request.user)
job.reject_code(by=self.request.user)
Sorry, something went wrong.
No branches or pull requests
model:
(Successfully prints user's
id
but doesn't persistby
to StateLog)views.py:
DB:
REPL:
This is with the latest pip release, 1.5.0
The text was updated successfully, but these errors were encountered: