def update_address(queryset):
  count = queryset.count()
  i = 0
  print "n;total;name;legacy;new;id"
  for item in queryset:
    i += 1
    name = item.name

    try:
      if item.user:
        item = item.user
    except:
      pass

    if item.address != None:
      g = GoogleAddress(typed_address=item.address.__unicode__(), typed_address2=item.address.addressline2)
      g.save()
      item.googleaddress = g
      item.save()
      print u"{};{};{};{};{};{}".format(i, count, name, item.address.__unicode__(), item.googleaddress.address_line, item.googleaddress.id).encode('utf8')
Exemplo n.º 2
0
def create_address():
    address = GoogleAddress(typed_address=u"São Paulo, SP, Brasil")
    address.save()
    return address