-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'str' object has no attribute 'roles' #9
Comments
Hi Leo, I finally did get a chance to look at this, and I had trouble producing your exact error. I saw some others, which we can talk about & I might know what's causing them (mentioned below). However, the good news is I have a completely functional example using your above User model code at https://github.com/bepetersn/flask-permissions-ex. It's been a little while since I looked at this stuff, but the biggest change with my fork (re: the above-mentioned errors) is you shouldn't instantiate UserMixin now -- it's an abstract model base. So you want to use a User model like yours above. And that can cause some errors -- I got a different one from yours about not being able to set roles. Let me know what you think. |
Hi Brian,
|
I assume with this line... You need to create a user instance with your User model, which should be a subclass of UserMixin. You can't do it with UserMixin directly anymore. I'm considering this a documentation failure, so I'm presently updating the README to show the right way to actually create a user with the new code. I'm going to fix the tests with this too, so the PR will finally be ready! |
Hi, i'm trying to follow the steps but i'm getting a error when i try to add roles to user (UserMIxin instance) and i'm not sure how to put all together..
But when i create a normal user, i usually do
my model is like this:
any tips on how to do i right? :)
(im using @bepetersn fork)
The text was updated successfully, but these errors were encountered: