32 | | tablename = "%s_%s" % (module, resource) |
33 | | table = s3db.define_table(tablename, |
34 | | Field("name"), |
35 | | *s3_meta_fields()) |
36 | | table.uuid.requires = IS_NOT_IN_DB(db, "%s.uuid" % table) |
37 | | table.name.requires = IS_NOT_EMPTY() |
38 | | table.name.comment = SPAN("*", _class="req") |
| 34 | class S3VehicleModel(S3Model): |
| 35 | """ |
| 36 | Vehicle Management |
| 37 | """ |
| 38 | |
| 39 | names = ["vms_vehicle", |
| 40 | "vms_vehicle_type", |
| 41 | ] |
| 42 | |
| 43 | def model(self): |
| 44 | |
| 45 | T = current.T |
| 46 | db = current.db |
| 47 | |
| 48 | tablename = "vms_vehicle" |
| 49 | represent = S3Represent(lookup=tablename) |
| 50 | table = s3db.define_table(tablename, |
| 51 | Field("name", |
| 52 | requires = IS_NOT_EMPTY() |
| 53 | ), |
| 54 | Field("type", |
| 55 | requires=IS_ONE_OF(db, |
| 56 | "vms_vehicle_type.id", |
| 57 | represent), |
| 58 | ) |
| 59 | *s3_meta_fields()) |