Skip to content

Commit

Permalink
added social import
Browse files Browse the repository at this point in the history
  • Loading branch information
tsilva committed Jun 8, 2016
1 parent 3803747 commit c41a19a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/budy/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,28 @@ def notify(self, name = None):
)
)

@classmethod
@appier.link(
name = "Import Social CSV",
parameters = (
("CSV File", "file", "file"),
("Empty source", "empty", bool, True)
)
)
def import__social_csv_s(cls, file, empty):

def callback(line):
username, facebook_id, google_id = line
username = username or None
facebook_id = facebook_id or None
google_id = google_id or None
account = BudyAccount.get(username = username)
account.facebook_id = facebook_id
account.google_id = google_id
account.save()

cls._csv_import(file, callback)

@property
def title(self):
return "Mrs." if self.gender == "Female" else "Mr."
Expand Down

0 comments on commit c41a19a

Please sign in to comment.