You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have custom model that contains a TaskResult as OneToOneField:
class MyModel(models.Model):
task = models.OneToOneField(TaskResult, on_delete=models.SET_NULL, null=True)
...
in my view, I do something like:
@receiver(post_save, sender=TaskResult, dispatch_uid='task_update')
def _on_task_save(sender, instance, **kwargs):
print("POST_SAVE: ", instance.task_id, instance.id)
def view(request):
form = models.MyModelForm(data=request.POST)
if form.is_valid():
obj :models.MyModel = form.instance
result = my_celery_task.delay(obj.xxx)
obj.save()
return render(request, 'app/index.html')
Then I found the _on_task_save is nerver trigger, but the data is written into the db, which could be checked by python manage.py shell and then run TaskResult.objects.all().
I have found a similar issue #41, but it doesn't solve my problem.
Thanks for any help!
The text was updated successfully, but these errors were encountered:
I have custom model that contains a
TaskResult
asOneToOneField
:in my view, I do something like:
Then I found the
_on_task_save
is nerver trigger, but the data is written into the db, which could be checked bypython manage.py shell
and then runTaskResult.objects.all()
.I have found a similar issue #41, but it doesn't solve my problem.
Thanks for any help!
The text was updated successfully, but these errors were encountered: