Hi,

I'm trying to design an application to manage a wine-tasting party.  Each 
invitee can bring guests. They're in a "tasters" table.  Each invitee and 
guest(s) brings a bottle of wine. The details of each wine are in a "wines" 
table.  Many tasters to one wine. And finally a "scores" table with rows 
consisting of a taster ID, a wine ID and a score.  (I may implement a 
"regions" table as well.)

For the registration, I'd like to have a form that asks for a taster (name 
only) and the wine they're bringing (wine name, vintage, etc, etc). But I 
want a [+] icon next to the taster that adds another taster to be linked to 
the same wine being entered into the form...  So far, I don't have much 
beyond a working model, listed below.

Any suggestions of how to speed up my learning, assuming that I've not 
worked with frameworks at all and am not much of an OOP guy?  (I'm working 
on it...)

Thanks!

Tables definitions below:
___________________________________________________

db.define_table("wines",
                Field("wine_entered", "datetime",
                      writable=False,readable=False,
                      default=request.now),
                Field("tag", "string", length=4, unique=True,
                      required=True, notnull=True,
                      comment="Wine Tag ID"),
                Field("color", "string", length=5,
                      required=True, notnull=True,
                      comment="Color (White or Red)"),
                Field("wine", "string",
                      required=True, notnull=True,
                      comment="Wine name"),
                Field("varietal", "string",
                      required=True, notnull=True,
                      comment="Varietal"),
                Field("vintage", "integer",
                      required=True, notnull=True,
                      comment="Year"),
                Field("region", "string",
                      required=True, notnull=True,
                      comment="Region (Country or State)"),
                Field("cost", "decimal(2,2)",
                      required=True, notnull=True,
                      comment="Wine cost"),
                Field("vintner", "string",
                      comment="Vintner"),
                format="%(tag)s")

db.wines.color.requires        = [IS_IN_SET(["Red", "White"],
                                            zero=T("Color?"),
                                            error_message=T("Must be Red or 
White"))]
db.wines.vintage.requires      = [IS_INT_IN_RANGE(1910, 2012)]
db.wines.cost.requires         = [IS_DECIMAL_IN_RANGE(0, 30)]

db.define_table("tasters",
                Field("taster_entered", "datetime", 
                      writable=False,readable=False, 
                      default=request.now),
                Field("taster", "string", unique=True,
                      required=True, notnull=True,
                      comment="Taster (last name, first name)"),
                Field("wine_id", db.wines,
#                     required=True, notnull=True,
#                     writable=False,readable=False, 
                      comment="Wine ID"),
                format="%(taster)s")

db.define_table("scores",
                Field("score_entered", "datetime",
                      writable=False,readable=False, 
                      default=request.now),
                Field("scorer_id", db.tasters,
                      required=True, notnull=True,
                      writable=False,readable=False, 
                      comment="Taster ID"),
                Field("wine_id", db.wines,
                      required=True, notnull=True,
                      writable=False,readable=False, 
                      comment="Wine ID"),
                Field("score", "integer",
                      required=True, notnull=True,
                      comment="Score"),
                format="%(scorer_id wine_id)s")

#db.define_table("regions",
#                Field("region_entered", "datetime",
#                      writable=False,readable=False, 
#                      default=request.now),
#                Field("scope","integer",
#                      required=True, notnull=True,
#                      comment="Country or State"),
#                Field("iso2","text",
#                      required=True, notnull=True,
#                      comment="ISO-2 abbriviation"),
#                Field("iso3","text",
#                      required=True, notnull=True,
#                      comment="ISO-3 abbriviation"),
#                Field("region", "text",
#                      required=True, notnull=True,
#                      comment="Region name"),
#                format="%(iso2)s")
#
#db.regions.scope.requires          = [IS_NOT_EMPTY()]
#db.regions.scope.writable          = db.regions.scope.readable          = 
False
#db.regions.wine_id.writable        = db.regions.wine_id.readable        = 
False
#db.regions.region_entered.writable = db.regions.region_entered.readable = 
False

Reply via email to