嗨,我是django和python的新手。你知道吗
# function for fecthing the child
def get_childern(request, username):
Q = list(Profile.objects.filter(sponsor_id__exact=username))
populate(request, Q, username)
# Iterate the Queryset
def populate(request, quesryset, username):
if quesryset:
messages.success(request, username+' has '+str(len(quesryset))+' child')
messages.info(request, quesryset)
for user in quesryset:
get_childern(request, user.user_id)
else:
messages.warning(request, 'User '+username+' has no child')
return False
# calling all children
get_childern(request, username)
我想增加一个层次,如何进一步分解。你知道吗
请帮助我,投入大量的时间和精力。 感谢所有人:)
我找到了解决方案如果有人想提供一些反馈或更好的解决方案的想法,请在这里发表评论。感谢所有人:)
相关问题 更多 >
编程相关推荐