def get_entity1(self):
        address = Address()
        address.line1 = "17, The Pines, Diamond Valley"
        address.line2 = "Upper Dargle Road"
        address.city = "Bray"
        address.province = "Wicklow"
        address.country = "IE"
        address.zip_code = "Wicklow"

        return address
    def get_entity2(self):
        address = Address()
        address.line1 = "32, Lower O'Connell Street"
        address.city = "Dublin"
        address.province = "Dublin"
        address.country = "IE"
        address.zip_code = "Dublin1"
        address.longtitude = 53.349559
        address.latitude = -6.259747

        return address
Ejemplo n.º 3
0
def generate_addresses(request, times):
    for i in range(0, times):
        a = Address()
        idx = random.randint(0, 1)
        a.address_type = ['B', 'S'][idx]
        a.first_name = random_text('t', 15)
        a.last_name = random_text('t', 15)
        a.address = random_text('t', 50)
        a.zipcode = random_text('n', 5)
        a.country = random_text('t', 10)
        a.city = random_text('t', 10)
        a.save()
    return HttpResponse(f'{times} Addresses generated !')
Ejemplo n.º 4
0
def signupLevel1(request):
    activationKey = request.data.get('activationKey')
    verifyMobileNumber = request.data.get('verifyMobileNumber')
    profile = get_object_or_404(Profile, activationKey=activationKey)
    profile.user.set_password(request.data.get('password'))
    profile.user.is_active = True
    profile.user.save()
    profile.dob = request.data.get('dob')
    address = Address()
    address.country = request.data.get('country')
    address.region = request.data.get('region')
    address.city = request.data.get('city')
    address.street = request.data.get('address')
    address.zipCode = request.data.get('zipcode')
    address.save()
    profile.defaultAddress = address
    profile.mobile = request.data.get('mobile')
    if request.data.get('ssn') and len(request.data.get('ssn')) > 0:
        profile.ssn = request.data.get('ssn')
    profile.termsAgreement = request.data.get('agreement')
    profile.setVerificationCode()
    profile.save()
    try:
        if verifyMobileNumber:
            messageSend = sendVerificationCodeSMS(request,
                                                  profile.verificationCode,
                                                  profile.mobile)
        else:
            profile.setActivationKey()
            profile.mobileVerified = True
            profile.save()
        return Response({'success': True})
    except Exception as e:
        return Response({
            'success': False,
            'error': {
                'code': 'no.sms.sent',
                'msg': e.message
            }
        })