Skip to content

Commit

Permalink
better account structure
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 21, 2016
1 parent 64f0ca8 commit e691bbb
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions src/budy/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,40 @@ class BudyAccount(appier_extras.admin.Account):
"budy."
]

name = appier.field()
GENDER_S = dict(
Male = "Male",
Female = "Female"
)

first_name = appier.field(
index = True
)

last_name = appier.field(
index = True
)

gender = appier.field(
meta = "enum",
enum = GENDER_S
)

birth_date = appier.field(
type = int,
index = True,
meta = "datetime"
)

country = appier.field(
meta = "country"
)

phone_number = appier.field()

receive_newsletters = appier.field(
type = bool,
initial = False
)

addresses = appier.field(
type = appier.references(
Expand All @@ -70,7 +103,7 @@ def _get_bag_key(cls, id):

def pre_create(self):
appier_extras.admin.Account.pre_create(self)
if not hasattr(self, "name"): self.name = self.username
if not hasattr(self, "first_name"): self.first_name = self.username

def post_create(self):
appier_extras.admin.Account.post_create(self)
Expand Down

0 comments on commit e691bbb

Please sign in to comment.