Skip to content
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

Bulk Invites Via JSON - Unclear Documentation #125

Open
fsecada01 opened this issue Jul 12, 2019 · 1 comment
Open

Bulk Invites Via JSON - Unclear Documentation #125

fsecada01 opened this issue Jul 12, 2019 · 1 comment

Comments

@fsecada01
Copy link
Contributor

So I'm trying to implement this invite system for the first beta build of my platform before opening it up. Right now I'm using the Admin view to push individual invitations but this is completely inefficient. I'm trying to figure out how to push many invites via the JSON process but the request object requirement is messing things up for me.

Can the maintainer provide a use-case example in the docs to help out? Other modules have examples in their documentation and that goes a long way with increasing familiarity.

@fsecada01
Copy link
Contributor Author

My existing workaround (which is not really sufficient or safe) is to iterate through the invite list and push through every single email instance.

from django.test import RequestFactory

invite_emails = <email_list_obj>

req_inst = RequestFactory().get(url_link, HTTP_HOST='host_name')

for email in invite_emails:
    try:
        invite = Invitation.create(email, User.objects.get(email=User_Email))
        invite.send_invitation(request_inst)
    except Exception as e:
        print(type(e), e.args, e)
        continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant