Skip to content

Commit

Permalink
initial address support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 18, 2016
1 parent c73c185 commit 50ba640
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/budy/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
""" The license for the module """

from . import account
from . import address
from . import bag_line
from . import bag
from . import base
Expand All @@ -55,6 +56,7 @@
from . import subscription

from .account import BudyAccount
from .address import Address
from .bag_line import BagLine
from .bag import Bag
from .base import BudyBase
Expand Down
70 changes: 70 additions & 0 deletions src/budy/models/address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Hive Budy
# Copyright (c) 2008-2016 Hive Solutions Lda.
#
# This file is part of Hive Budy.
#
# Hive Budy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foundation, either version 2.0 of the License, or (at your option) any
# later version.
#
# Hive Budy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Apache License for more details.
#
# You should have received a copy of the Apache License along with
# Hive Budy. If not, see <http://www.apache.org/licenses/>.

__author__ = "João Magalhães <joamag@hive.pt>"
""" The author(s) of the module """

__version__ = "1.0.0"
""" The version of the module """

__revision__ = "$LastChangedRevision$"
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2016 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

import appier

from . import base

class Address(base.BudyBase):

first_name = appier.field(
index = True
)

last_name = appier.field(
index = True
)

address = appier.field()

address_extra = appier.field()

postal_code = appier.field()

city = appier.field()

state = appier.field()

country = appier.field()

phone_number = appier.field()

vat_number = appier.field()

neighborhood = appier.field()
16 changes: 15 additions & 1 deletion src/budy/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,26 @@ class Order(bundle.Bundle):
)

account = appier.field(
type = appier.references(
type = appier.reference(
"BudyAccount",
name = "id"
)
)

shipping_address = appier.field(
type = appier.reference(
"Address",
name = "id"
)
)

billing_address = appier.field(
type = appier.reference(
"Address",
name = "id"
)
)

@classmethod
def list_names(cls):
return ["id", "key", "currency", "total", "account"]
Expand Down

0 comments on commit 50ba640

Please sign in to comment.