ためジャンゴ・nonrelで働きます。作るためにどのようにグループの権限は、私はGAEのためのジャンゴ - nonrelのために働いて役割ベースのアクセス許可を取得しようとしているGoogle App Engineの
ユーザーとグループの暗黙的な多対多の関係のために、おそらく動作していないと思われたので、http://www.fhahn.com/writing/Django-s-Permission-System-with-Django-Nonrelを見つけてインストールしました。ドキュメントごとに、私は(djangotoolboxの後の)INSTALLED_APPSにpermission_backend_nonrelを追加し、settings.pyの適切なクラスにAUTHENTICATION_BACKENDSを定義しました。
これは以前の問題( "DatabaseError:このクエリはデータベースでサポートされていません。")を過ぎてしまいましたが、私は非常に単純なサンプルを実行すると、私は何かを取り戻すべきだと思う。以下は、私が作ることができるほど簡単な例です。これは、python manage.pyシェルによってdjangoフレームワークで起動しました。これはシンプルなポニーショップです。私は、グループにユーザーを追加し、そのグループのアクセス権を与え、その後、これらのアクセス許可は、ユーザーが持っている権限のセットの一部として反映参照しようとしています:だから
>>> from django.contrib.auth.models import Group, Permission, User
>>> from django.contrib.contenttypes.models import ContentType
>>> from pony_shop.models import Pony
#Create the group:
>>> farmers = Group(name="Farmers")
>>> farmers.save()
>>> pony_ct = ContentType.objects.get(app_label='pony_shop', model='pony')
#Create the Permission
>>> can_twirl = Permission(name='Can Twirl', codename='can_twirl', content_type=pony_ct)
>>> can_twirl.save()
#Give the Permission to the Group
>>> farmers.permissions.add(can_twirl)
>>> farmers.save()
#Create the User
>>> francis = User(username='francis')
>>> francis.save()
#Put the user in the group
>>> francis.groups.add(farmers)
>>> francis.save()
#Get a pony object
>>> firefly = Pony(price=12, height=3, name='Firefly', color='fuscia')
>>> firefly.save()
>>> francis.get_all_permissions()
set([]) #<-- WHY?!?
#Just in case I needed to check the permissions against a pony object:
>>> francis.get_all_permissions(obj=firefly)
set([]) #<-- Still no joy
、質問は次のとおりです。「なぜdoesnの上記の作業、そしてそれを機能させるためには何を変更する必要がありますか?
ご協力いただきありがとうございます。