Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

90 lines (74 sloc) 2.476 kB
import os
import re
import datetime
import traceback
import urllib
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import users
from google.appengine.api import images
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import demjson
class UserCreated(db.Model):
owner = db.UserProperty(auto_current_user_add=True)
created = db.DateTimeProperty(auto_now_add=True)
modified = db.DateTimeProperty(auto_now=True)
class RecipeBox(UserCreated):
color = db.StringProperty()
contents = db.ListProperty(db.Key) # Recipe
class User(db.Model):
who = db.UserProperty(auto_current_user_add=True)
first_name = db.StringProperty()
last_name = db.StringProperty()
image_original = db.BlobProperty()
image = db.BlobProperty()
friends = db.ListProperty(users.User)
box = db.ReferenceProperty(RecipeBox)
starred = db.ListProperty(db.Key) # Recipe
VOLUME, WEIGHT, DISCRETE = range(3)
VOLUME_UNITS = {
'tsp': 1,
'tbsp': 3,
}
WEIGHT_UNITS = {
}
class Item(UserCreated):
name = db.StringProperty()
name_plural = db.StringProperty()
description = db.TextProperty()
upc = db.IntegerProperty()
unit_type = db.IntegerProperty(choices=[VOLUME, WEIGHT, DISCRETE])
unit = db.StringProperty()
unit_plural = db.StringProperty()
class Ingredient(db.Model):
item = db.ReferenceProperty(Item)
amount = db.IntegerProperty()
unit = db.StringProperty()
class Instruction(db.Model):
body = db.TextProperty()
image_original = db.BlobProperty()
image = db.BlobProperty()
class Recipe(UserCreated):
name = db.StringProperty()
ingredients = db.ListProperty(db.Key) # Ingredient
instructions = db.ListProperty(db.Key) # Instruction
category = db.StringProperty()
makesserves = db.BooleanProperty() # True = makes, False = serves
number = db.IntegerProperty()
what = db.StringProperty()
tags = db.StringListProperty()
source = db.StringProperty()
stars = db.IntegerProperty()
image_original = db.BlobProperty()
image = db.BlobProperty()
BREAKFAST, LUNCH, DINNER, SUPPER, SNACK, OTHER = range(6)
class Menu(UserCreated):
when = db.DateProperty()
what = db.ListProperty(db.Key) # Recipe
meal = db.IntegerProperty(choices=range(6)) # (see above)
class Notification(db.Expando):
receiver = db.UserProperty()
sender = db.UserProperty()
type = db.StringProperty()
Jump to Line
Something went wrong with that request. Please try again.