Example #1
0
def import_contacts(request):
    try:
        if request.method == 'POST':
            from accounts.forms import ImportContactsForm
            form = ImportContactsForm(data=request.POST)

            if form.is_valid():
                o = OpenInviter()
                contacts = o.contacts(request.POST['email'], request.POST['password'])

                total = len(contacts)

                if contacts is not None:
                    return render_to_response('accounts/contacts.html', {'accounts_active':'active', 'contacts':contacts, 'total':total, },
                                            context_instance=RequestContext(request))
                else:
                    return HttpResponseRedirect(reverse('accounts'))
        else:
            from accounts.forms import ImportContactsForm
            form = ImportContactsForm()

        return render_to_response('accounts/import.html', {'accounts_active':'active', 'form':form, },
                                        context_instance=RequestContext(request))
    except Exception, e:
        messages.error(request, e.message)
        
        return render_to_response('accounts/import.html', {'accounts_active':'active', 'form':form, },
                                        context_instance=RequestContext(request))
Example #2
0
    def get_contacts(self, credentials):
        email = credentials["email"]
        password = credentials["password"]

        from django_open_inviter.open_inviter import OpenInviter

        o = OpenInviter()

        contacts = o.contacts(email, password)

        for contact in contacts:
            contact_name = contact["name"]
            contact_email = contact["emails"][0]
            yield {
                "name": contact_name,
                "email": contact_email,
            }
Example #3
0
    def get_contacts(self, credentials):
        email = credentials["email"]
        password = credentials["password"]

        from django_open_inviter.open_inviter import OpenInviter
        
        o = OpenInviter()  

        contacts = o.contacts(email, password)
        
        for contact in contacts:
            contact_name = contact["name"]
            contact_email = contact["emails"][0]
            yield {
                "name": contact_name,
                "email": contact_email,
            }
Example #4
0
def index(request):
    oi = OpenInviter()
    services = oi.services()

    contacts = False

    if request.method == 'POST': # If the form has been submitted...
        form = FriendImportServiceForm(request.POST)
        #print form.contacts
        if form.is_valid():
            contacts = form.contacts
    else:
        form = FriendImportServiceForm()

    return render_to_response('index.html', {
        'services': services,
        'contacts': contacts,
        'form': form
    }, context_instance = RequestContext(request))
Example #5
0
def index(request):
    oi = OpenInviter()
    services = oi.services()

    contacts = False

    if request.method == 'POST':  # If the form has been submitted...
        form = FriendImportServiceForm(request.POST)
        #print form.contacts
        if form.is_valid():
            contacts = form.contacts
    else:
        form = FriendImportServiceForm()

    return render_to_response('index.html', {
        'services': services,
        'contacts': contacts,
        'form': form
    },
                              context_instance=RequestContext(request))
Example #6
0
def import_contacts(request):
    try:
        if request.method == 'POST':
            from accounts.forms import ImportContactsForm
            form = ImportContactsForm(data=request.POST)

            if form.is_valid():
                o = OpenInviter()
                contacts = o.contacts(request.POST['email'],
                                      request.POST['password'])

                total = len(contacts)

                if contacts is not None:
                    return render_to_response(
                        'accounts/contacts.html', {
                            'accounts_active': 'active',
                            'contacts': contacts,
                            'total': total,
                        },
                        context_instance=RequestContext(request))
                else:
                    return HttpResponseRedirect(reverse('accounts'))
        else:
            from accounts.forms import ImportContactsForm
            form = ImportContactsForm()

        return render_to_response('accounts/import.html', {
            'accounts_active': 'active',
            'form': form,
        },
                                  context_instance=RequestContext(request))
    except Exception, e:
        messages.error(request, e.message)

        return render_to_response('accounts/import.html', {
            'accounts_active': 'active',
            'form': form,
        },
                                  context_instance=RequestContext(request))