Closed bharatnc closed 5 years ago
Hi Bharhat!
Likely the solution is that you're going to need to override the backend class.
It looks like your custom user model doesn't have a field named is_active
, which the backend class looks for. If your model is not based on contrib.auth.models.AbstractUser
it wouldn't inherit this field name.
@bennylope , thank you for the reply. What would you recommend if I were to use custom user model. Is there a specific solution that you would recommend?
Yep, create a backend class of your own inheriting from the default class so you can override this.
Unfortunately the is_active
attribute is used twice, once on line 130 and then again on line 140. Otherwise I'd just edit this right now myself to expose a separate "get_user
" method you could override. And then configure this as your default backend (or use it explicitly).
At any rate, this is the recommended way of accommodating any kind of custom model or workflow in the invitation.
There is also a new model-based invitation backend in development, which is pre-release on PyPI (aside from what's in the source code there is very little documentation for this yet though).
Thank you @bennylope , I will take a look. :)
What?
FieldError at /invite/22-NNMJeXMMU3-0/
Cannot resolve keyword 'is_active' into field. Choices are: active, admin, email, id, last_login, logentry, name, organizations_organization, organizations_organizationuser, password, social_auth, staff
How?
After following this https://django-organizations.readthedocs.io/en/latest/custom_usage.html#creating-the-backend and registering the urls for invite, when I try to load a url like
http://localhost:8000/invite/22-NNMJeXMMU3-0/
I receive the above error.Am I missing anything here? I have defined a custom backend for invitation and registration - as given in the documentation and also have registered the same. Using a Proxy Account and AccountUser model from AbstractOrganization and AbstractOrganizationUser.
Also:
This seems to be the code that django is not happy about . File is
site-packages/organizations/backends/defaults.py
Thanks!