tôi đã cố gắng sau Mã với sự giúp đỡ của django.contrib.auth.User và django.contrib.auth.Grouplà có một đơn giản để có được tên nhóm của người dùng trong django
for g in request.user.groups:
l.append(g.name)
Nhưng điều đó thất bại và tôi nhận được sau Lỗi:
TypeError at/
'ManyRelatedManager' object is not iterable
Request Method: GET
Request URL: http://localhost:8000/
Exception Type: TypeError
Exception Value:
'ManyRelatedManager' object is not iterable
Exception Location: C:\p4\projects\...\users.py in permission, line 55
Nhờ sự giúp đỡ!
công trình như một say mê! – icn