From c86ec88c4cb8cc998f0c3d29161335b70d41c96e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 20 Feb 2011 14:49:20 -0500 Subject: [PATCH] Added skeleton Category --- convore/groups.py | 18 +++++++++++++++++- convore/models.py | 9 +++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/convore/groups.py b/convore/groups.py index 8d19ca9..a188f87 100644 --- a/convore/groups.py +++ b/convore/groups.py @@ -62,4 +62,20 @@ class GroupsDiscoverExplore(object): class GroupDiscoverCategory(SyncedList): - pass + + __data_keys__ = ['name',] + + def __init__(self): + super(GroupDiscoverCategory, self).__init__() + + def get(self, key): + pass + + def sync(self): + r = requests.get(API_URL + 'groups.json') +# for _group in json.loads(r.content)['groups']: +# +# group = models.Group() +# group.import_from_api(_group) +# group.joined = True +# self.data.append(group) diff --git a/convore/models.py b/convore/models.py index 587afd1..dde7faf 100644 --- a/convore/models.py +++ b/convore/models.py @@ -40,6 +40,7 @@ class Group(object): self.id = None self.joined = False + def import_from_api(self, d): """Constructs Group from Deserialized API Response.""" @@ -72,3 +73,11 @@ class Group(object): def __repr__(self): return '' % (self.slug) + + +class Category(self): + def __init__(self): + pass + + def import_from_api(self, d): + """Constructs Category from deserialized API Response."""