mardi 29 mars 2016

Django custom permissions not being recognized?

I have custom permissions in my meta:

class Meta(): #extra bit of info
    model = User
    permissions = (
        ("has_uploaded", ("Has uploaded")),
        ("is_authenticated", ("Is authenticated")),
    )
    fields = ('email','emailConfirm','password1','biography','research_place','studies')

however when I try to do

is_auth_perm = Permission.objects.get(codename='is_authenticated')
request.user.user_permissions.add("is_auth_perm")

in my views I get the error that the permission does not exist, even after i do migrations and syncdb. am i doing something wrong?




Aucun commentaire:

Enregistrer un commentaire