Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
from posts import * | ||
# from archive import * | ||
# from feed import * | ||
# from pages import * | ||
# from projects import * | ||
# from admin import * | ||
from archive import * | ||
from feed import * | ||
from pages import * | ||
from projects import * | ||
from admin import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
class Group(db.Model): | ||
name = db.StringProperty() | ||
|
||
|
||
class Membership(db.Model): | ||
user = db.ReferenceProperty(User) | ||
group = db.ReferenceProperty(Group) | ||
group_name = db.StringProperty() | ||
|
||
def put(self): | ||
self.group_name = self.group.name | ||
super(Membership, self).put() | ||
|
||
def get_group(self, name): | ||
return [n.group for n in user.membership_set.order('group_name')] | ||
|
||
@classmethod | ||
def create(username, groupname): | ||
Super(Membership, user = username, group = groupname).put() | ||
# Membership.get_or_insert(key_name = "%s-%s" % (user.key(), group.key()), user = user, group = group).put() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
class Comment(db.Model): | ||
name = db.StringProperty() | ||
email = db.StringProperty() | ||
content = db.TextProperty() | ||
pubdate = db.DateTimeProperty(auto_now_add=True) | ||
views = db.IntegerProperty(default=0) | ||
|
||
def get_views(self): | ||
viewcount = self.views | ||
viewcount_cache = memcache.get('test-views-' + self.key().name(), self.key().kind()) | ||
if viewcount_cache: | ||
viewcount += viewcount_cache | ||
return viewcount | ||
|
||
@classmethod | ||
def flush_views(cls, name): | ||
te |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# todo inherit from built in user property support twitter et al | ||
|
||
class User(db.Model): | ||
name = db.StringProperty() | ||
email = db.StringProperty() | ||
author = db.UserProperty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters