Open sureshvv opened 11 months ago
I think there is no way to do that. If you share the DB between your site and Spirit, all users will be Spirit users. If you don't create a Spirit user profile, it won't matter, because the user is authenticated and assigned to request.user anyway. You would only get an error about the profile not existing for the user when visiting the Spirit user profile. on a second thought, if you point Spirit profile to some model other than the Django user model or a custom one defined as AUTH_USER_MODEL, Spirit won't work at all.
Not sure you can have two user models in Django.
If you want to forbid some users from accessing the forum, you are better off creating a model with a OneToOneField to Django user model, and some is_forum_allowed
field. Then use that field to check if the user can access the forum. The check can be done in a custom middleware similar to this one, but redirecting them to your site if they are not allowed.
I have done that. Only thing is still all the users show up in spirit:admin:users.
I was looking for a non-intrusive way of listing only the spirit users.
probably something like this in a custom app:
from spirit.user.admin import views
org_index = views._index
def new_index(request, queryset, template):
return org_index(request, queryset.filter(custom_user__has_forum_access=True), template)
views._index = new_index
Another way is overriding the template and filtering there.
Don't want all users on my site to be spirit users