Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jun 8, 2016
2 parents 89b1e35 + c32442f commit 45903ed
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/budy/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,26 @@ def _build_short_name(cls, first_name, last_name, limit = 16):
last = last_name[0] + "." if last_name else ""
return first + (" " + last if last else "")

@classmethod
@appier.operation(
name = "Import Social CSV",
parameters = (
("CSV File", "file", "file"),
("Strict", "strict", bool, False)
)
)
def import_social_csv_s(cls, file, strict):

def callback(line):
username, facebook_id, google_id = line
account = cls.get(username = username, raise_e = strict)
if not account: return
if facebook_id: account.facebook_id = facebook_id
if google_id: account.google_id = google_id
account.save()

cls._csv_import(file, callback)

def pre_create(self):
appier_extras.admin.Account.pre_create(self)
if not hasattr(self, "first_name") or not self.first_name:
Expand All @@ -153,7 +173,7 @@ def post_create(self):
self.ensure_bag_s()
self.notify()

def recover_s(self, send_email=False):
def recover_s(self, send_email = False):
result = appier_extras.admin.Account.recover_s(
self,
send_email = send_email
Expand Down

0 comments on commit 45903ed

Please sign in to comment.