bennylope / django-organizations

:couple: Multi-user accounts for Django projects

Home Page:http://django-organizations.readthedocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I add django-organizations to a Rest API project?

rakshit9 opened this issue · comments

I also facing the same Issues Is there any way to use?

Short answer - yes - we've added it successfully. Just like any other model we've created. There are certain some caveats and gotchas for using it, but we're very happy with picking this solution.

I came to open an issue about this, so I'll update this one.

The major problem in this implementation is the BaseBackend, which enforces the usage of a form instead of allowing (perhaps guessing?) if the application uses rest framework or not.

I think we should update the BaseBackend to include the possibility of a Rest Framework application, by removing all the forms variables and creating a FormBaseBackend and a SerializerBaseBackend, or either implementing a check if rest framework is installed or a setting option (probably a list) allowing both usages of forms and serializers.

If you agree, I might be able to upload an update on this issue in the next 15 days

@Cataldir, the short answer is yes!

Regardless of the solution, it would be better to be explicit, such that it works as expected for current users (providing a form class by default, for example), and allowing a serializer class instead. Guessing based on installed apps could have unintended effects.

Since I presume you're talking about the invitations/registration, a totally separate or parallel set of backends classes would be another option. It might be more lines of code, but would probably allow for simpler development, testing, and end-user extenadability. What you think?