1: Model and Purpose

Next Step >


At the heart of this web service, is a data model that directly reflects the application's purpose.

The core model must reflect three categories of program activity. 

I. Fundamental centers:
  • user
  • admin
  • group
  • user page
  • admin page 
  • group page
  • text section
II. Inter-center relations (connections / joints)

 One-to-one:
  • each OurUser matches a Google API User
  • each text section has an owner that is a user.
  • each text section is associated with a Page
  • each User has a user Page
  • each Group has a group Page
 One-to-many:
  • each Group has group members that are users
  • each Group has group admins that are users
  • each page has text sections
III. Fundamental pathways:
  • text section add / delete /edit (list owner)
  • group create / delete
  • group join / leave

# uag.py: user-admin-group


# import section import cgi import os from google.appengine.ext import db from google.appengine.api import users
# database model section class Page(db.Model): title = db.StringProperty(multiline=True) rows = db.IntegerProperty() columns = db.IntegerProperty() class TextSection(db.Model): row = db.IntegerProperty() column = db.IntegerProperty() class OurUser(db.Model): user = db.UserProperty() nickname = db.StringProperty(multiline=True) homepage = db.ReferenceProperty(Page) class SiteAdmin(db.Model): user = db.ReferenceProperty(OurUser) class Group(db.Model): name = db.StringProperty(multiline=True) homepage = db.ReferenceProperty(Page) class GroupAdmin(db.Model): user = db.ReferenceProperty(OurUser) nickname = db.StringProperty(multiline=True) group = db.ReferenceProperty(Group)


Comments