Exemplo n.º 1
0
    def setUp(self):
        self.place = Place(label='testing place', visible=True)
        place_type = PlaceType(description='a place type')
        place_type.save()
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        phone = Phone(area='23',
                      phoneNumber='45679078',
                      ext='4444',
                      phoneType=phone_type)
        phone.content_object = self.place

        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)

        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()

        address.city = city
        address.content_object = self.place

        self.place.save()
Exemplo n.º 2
0
def address_list(ids, addressPrefixs, addressLines1, addressLines2,
                 addressNumbers, neighborhoods, zipCodes, addressTypes,
                 city_ids, country_ids, stateChars, cityChars):
    objects = []
    for i in range(0, len(addressLines1)):
        if (len(addressLines1[i])):
            try:
                city = city_ids[i]
                objects.append(
                    Address(id=ids[i],
                            addressPrefix=addressPrefixs[i],
                            addressLine1=addressLines1[i],
                            addressLine2=addressLines2[i],
                            addressNumber=addressNumbers[i],
                            neighborhood=neighborhoods[i],
                            zipCode=zipCodes[i],
                            addressType=AddressType.objects.get(
                                pk=addressTypes[i]),
                            city=City.objects.get(pk=city)))
            except:
                objects.append(
                    Address(
                        id=ids[i],
                        addressPrefix=addressPrefixs[i],
                        addressLine1=addressLines1[i],
                        addressLine2=addressLines2[i],
                        addressNumber=addressNumbers[i],
                        neighborhood=neighborhoods[i],
                        zipCode=zipCodes[i],
                        addressType=AddressType.objects.get(
                            pk=addressTypes[i]),
                        foreignCountry=Country.objects.get(pk=country_ids[i]),
                        foreignState=stateChars[i],
                        foreignCity=cityChars[i]))
    return objects
Exemplo n.º 3
0
    def setUp(self):
        self.place = Place(label='testing place', visible=True)
        place_type = PlaceType(description='a place type')
        place_type.save()
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        phone = Phone(area='23', phoneNumber='45679078',
                      ext='4444', phoneType=phone_type)
        phone.content_object = self.place

        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)

        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()

        address.city = city
        address.content_object = self.place

        self.place.save()
Exemplo n.º 4
0
    def save(self, request, *args, **kwargs):
        organization = super(RegistrationForm, self).save(False, *args, **kwargs) # send_email = False 

        # add phone number to 'first' professional registered
        if self.cleaned_data['phone']:
            p = Phone()
            p.area = self.cleaned_data['phone'][1:3]
            p.phoneNumber = self.cleaned_data['phone'][5:15]
            p.phoneType_id = 2
            person = organization.care_professionals()[0]
            person.phones.add(p)
            
        # add cpf number to 'first' professional registered
        if self.cleaned_data['cpf']:
            d = Document()
            t = TypeDocument.objects.get(description='CPF')
            d.typeDocument_id = t.id
            d.document = self.cleaned_data['cpf']
            person.document.add(d)

        # add address to 'first' professional registered
        if self.cleaned_data['address']:
            a = Address()
            at = AddressType.objects.get(description='Comercial')
            a.addressType_id = at.id
            a.addressLine1 = self.cleaned_data['address']
            a.addressNumber = self.cleaned_data['address_number']
            a.zipCode = self.cleaned_data['zipcode']
            a.city_id = request.POST.get('city')
            person.address.add(a)
Exemplo n.º 5
0
    def setUp(self):
        self.schedule = ScheduleOccurrence()
        self.schedule.reserve = True
        self.schedule.annotation = "this is schedule test"
        self.schedule.start_time = datetime.now()
        self.schedule.end_time = datetime.now()

        self.place = Place(label='testing place')
        place_type = PlaceType(description='a place type')
        place_type.save()
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        self.phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                      phoneType=phone_type)
        self.phone.content_object = self.place
        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)
        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()
        address.city = city
        address.content_object = self.place
        self.place.save()
        self.room = Room()
        self.room.place = self.place
        room_type = RoomType()
        self.room.room_type = room_type
        self.room.furniture = "tree table"
        self.schedule.room = self.room
Exemplo n.º 6
0
    def setUp(self):
        self.place = Place(label='testing place')
        
        if len(PlaceType.objects.all())==0:
            place_type = PlaceType(description='Matriz')
            place_type.save()
            document = TypeDocument(description='CPF')
            document.save()
            a = AddressType(description='Comercial')
            a.save()
            room_type = RoomType()
            room_type.description = 'sala test'
            room_type.save()
            plan = Plan()
            plan.name = 'Teste 1'
            plan.value = 324.00
            plan.duration = 1
            plan.staff_size = 1
            plan.save()
            p = PaymentType()
            p.id = 1
            p.name = 'Teste 1'
            p.save()
            p  = PaymentType()
            p.id = 4
            p.name = 'Teste 4'
            p.save()
            country = Country(name='test', nationality='testing')
            country.save()
            state = State(name='test', shortName='t', country=country)
            state.save()
            city = City(name='test', state=state)
            city.save()
        else:
            place_type = PlaceType.objects.get(description='Matriz')
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        phone_type.save()
        self.phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                      phoneType=phone_type)
        self.phone.content_object = self.place
        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)

        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()

        address.city = city
        address.content_object = self.place

        self.place.save()
Exemplo n.º 7
0
def setup_required_data():
    country = Country(name='test', nationality='testing')
    country.save()
    place = Place(label='testing place')
    state = State(name='test', shortName='t', country=country)
    state.save()
    city = City(name='test', state=state)
    city.save()

    if len(PlaceType.objects.all()) == 0:
        placeType = PlaceType(description='Matriz')
        placeType.save()
        document = TypeDocument(description='CPF')
        document.save()
        a = AddressType(description='Comercial')
        a.save()
        room_type = RoomType()
        room_type.description = 'sala test'
        room_type.save()
        plan = Plan()
        plan.name = 'Teste 1'
        plan.value = 324.00
        plan.duration = 1
        plan.staff_size = 1
        plan.save()
        p = PaymentType()
        p.id = 1
        p.name = 'Teste 1'
        p.save()
        p = PaymentType()
        p.id = 4
        p.name = 'Teste 4'
        p.save()
    else:
        placeType = PlaceType.objects.get(description='Matriz')

    place.place_type = placeType

    phone_type = PhoneType(description='Recado', pk=2)
    phone_type.save()
    content_type_temp = ContentType()
    content_type_temp.save()
    phone = Phone(area='23',
                  phoneNumber='45679078',
                  ext='4444',
                  phoneType=phone_type,
                  content_type=content_type_temp)
    phone.content_object = place
    phone.save()
    address_type = AddressType(description='Home')
    address_type.save()
    address = Address()
    address.addressPrefix = 'Rua'
    address.addressLine1 = 'Rui Barbosa, 1234'
    address.addressLine2 = 'Anexo II - Sala 4'
    address.neighborhood = 'Centro'
    address.zipCode = '12345-123'
    address.addressType = address_type

    address.city = city
    address.content_object = place
    place.save()

    issuer = Issuer(description='SSP')
    issuer.save()

    email_type = EmailType(description='Comercial')
    email_type.save()

    instant_message = IMNetwork(description='Hangouts')
    instant_message.save()
Exemplo n.º 8
0
def setup_required_data():
    country = Country(name='test', nationality='testing')
    country.save()
    place = Place(label='testing place')
    state = State(name='test', shortName='t', country=country)
    state.save()
    city = City(name='test', state=state)
    city.save()

    if len(PlaceType.objects.all())==0:
        placeType = PlaceType(description='Matriz')
        placeType.save()
        document = TypeDocument(description='CPF')
        document.save()
        a = AddressType(description='Comercial')
        a.save()
        room_type = RoomType()
        room_type.description = 'sala test'
        room_type.save()
        plan = Plan()
        plan.name = 'Teste 1'
        plan.value = 324.00
        plan.duration = 1
        plan.staff_size = 1
        plan.save()
        p = PaymentType()
        p.id = 1
        p.name = 'Teste 1'
        p.save()
        p  = PaymentType()
        p.id = 4
        p.name = 'Teste 4'
        p.save()
    else:
        placeType = PlaceType.objects.get(description='Matriz')

    place.place_type = placeType

    phone_type = PhoneType(description='Recado', pk=2)
    phone_type.save()
    content_type_temp = ContentType()
    content_type_temp.save()
    phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                  phoneType=phone_type, content_type=content_type_temp)
    phone.content_object = place
    phone.save()
    address_type = AddressType(description='Home')
    address_type.save()
    address = Address()
    address.addressPrefix = 'Rua'
    address.addressLine1 = 'Rui Barbosa, 1234'
    address.addressLine2 = 'Anexo II - Sala 4'
    address.neighborhood = 'Centro'
    address.zipCode = '12345-123'
    address.addressType = address_type

    address.city = city
    address.content_object = place
    place.save()
    
    issuer = Issuer(description='SSP')
    issuer.save()

    email_type = EmailType(description='Comercial')
    email_type.save()

    instant_message = IMNetwork(description='Hangouts')
    instant_message.save()