我如何重定向回元素原来的位置?我有一个喜欢的按钮,当我单击它时,我希望它重定向回它原来的位置。现在,它重定向到页面顶部。
我尝试使用此解决方案return redirect(url()->previous().'#something');
,但此重定向回到页面底部
答案 0 :(得分:0)
尝试使用控制器
[I 191107 19:48:36 command:147] Registered tasks:
['celery.accumulate',
'celery.backend_cleanup',
'celery.chain',
'celery.chord',
'celery.chord_unlock',
'celery.chunks',
'celery.group',
'celery.map',
'celery.starmap']
刀片文件中
import time
from celery import Celery, group
from celery.result import AsyncResult, GroupResult
def get_app():
return Celery(
'worker',
broker='pyamqp://localhost/vhost',
backend='redis://localhost/0'
)
app = get_app()
@app.task
def add(x, y):
time.sleep(1)
return x + y
cf = add.si(0, 0) | group(add.si(1, 1), add.si(2, 2)) | add.si(3, 3)
res = cf.apply_async()
time.sleep(5) # just in case - wait for the tasks to finish
print(type(res.parent)) # <class 'celery.result.GroupResult'>
print(len(res.parent.children)) # 2
print(type(res.parent.parent)) # <class 'celery.result.AsyncResult'>
print(res.parent.parent.result) # 0
same_res = AsyncResult(res.id, app=app)
print(type(same_res.parent)) # <class 'NoneType'>
# print(len(same_res.parent.children)) # 'NoneType' object has no attribute 'children'
# print(type(same_res.parent.parent)) # 'NoneType' object has no attribute 'parent'
# print(same_res.parent.parent.result) # 'NoneType' object has no attribute 'parent'
same_group_res = GroupResult(res.parent.id, app=app)
print(same_group_res.parent) # None
print(same_group_res.children) # None