diff --git a/VERSION b/VERSION index 608d29f902..7d8ec241c4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -nursix-dev-5853-g4c80fdc2f (2024-02-22 16:43:37) +nursix-dev-5854-g1455ddb3f (2024-02-26 20:09:42) diff --git a/docs/source/extend/models/reusablefield.rst b/docs/source/extend/models/fieldtemplate.rst similarity index 72% rename from docs/source/extend/models/reusablefield.rst rename to docs/source/extend/models/fieldtemplate.rst index 8ee090cde2..b85872eb94 100644 --- a/docs/source/extend/models/reusablefield.rst +++ b/docs/source/extend/models/fieldtemplate.rst @@ -1,4 +1,4 @@ -Reusable Fields +Field Templates =============== Common Field Functions @@ -7,5 +7,5 @@ Common Field Functions Meta-Fields ----------- -Implementing Reusable Fields +Implementing Field Templates ---------------------------- diff --git a/docs/source/extend/models/index.rst b/docs/source/extend/models/index.rst index c87ccb3848..9b9dbb36e6 100644 --- a/docs/source/extend/models/index.rst +++ b/docs/source/extend/models/index.rst @@ -8,6 +8,6 @@ Implementing Data Models Basic Concepts Defining Tables Table Configuration - Reusable Fields + Field Templates Representation Methods diff --git a/models/tasks.py b/models/tasks.py index e9c89387fc..e9c321f86e 100644 --- a/models/tasks.py +++ b/models/tasks.py @@ -467,7 +467,7 @@ def sync_synchronize(repository_id, user_id=None, manual=False): current.s3task = s3task # ----------------------------------------------------------------------------- -# Reusable field for scheduler task links +# Field template for scheduler task links scheduler_task_id = FieldTemplate("scheduler_task_id", "reference %s" % s3base.S3Task.TASK_TABLENAME, ondelete = "CASCADE", diff --git a/modules/core/tools/translate.py b/modules/core/tools/translate.py index 315a98fc39..fc00291f6a 100644 --- a/modules/core/tools/translate.py +++ b/modules/core/tools/translate.py @@ -895,12 +895,12 @@ def get_database_strings(all_template_flag): elif hasattr(s3db, fieldname) is False: continue else: - reusable_field = s3db.get(fieldname) + field_template = s3db.get(fieldname) # Excludes lambdas which are in defaults() - # i.e. reusable fields in disabled modules + # i.e. field templates in disabled modules from ..model import FieldTemplate - if reusable_field and isinstance(reusable_field, FieldTemplate): - represent = reusable_field.attr.represent + if field_template and isinstance(field_template, FieldTemplate): + represent = field_template().represent if hasattr(represent, "translate"): translate = represent.translate diff --git a/modules/core/ui/widgets.py b/modules/core/ui/widgets.py index 1f61ed7634..898100724b 100644 --- a/modules/core/ui/widgets.py +++ b/modules/core/ui/widgets.py @@ -4106,7 +4106,7 @@ def __call__(self, field, value, **attributes): def s3_comments_widget(field, value, **attr): """ A smaller-than-normal textarea - to be used by the CommentsField & gis.desc_field Reusable fields + - used by the CommentsField & gis.desc_field templates """ _id = attr.get("_id", "%s_%s" % (field._tablename, field.name)) diff --git a/modules/s3db/asset.py b/modules/s3db/asset.py index b6a471384a..0d9549a854 100644 --- a/modules/s3db/asset.py +++ b/modules/s3db/asset.py @@ -271,7 +271,7 @@ def model(self): asset_represent = asset_AssetRepresent(show_link=True) - # Reusable Field + # Foreign Key Template asset_id = FieldTemplate("asset_id", "reference %s" % tablename, label = T("Asset"), ondelete = "CASCADE", diff --git a/modules/s3db/br.py b/modules/s3db/br.py index 9a64a87baf..3054e783b5 100644 --- a/modules/s3db/br.py +++ b/modules/s3db/br.py @@ -184,7 +184,7 @@ def model(self): orderby = "%s.workflow_position" % tablename, ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) status_id = FieldTemplate("status_id", "reference %s" % tablename, label = T("Case Status"), @@ -551,7 +551,7 @@ def model(self): msg_list_empty = T("No Activity Statuses currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) status_id = FieldTemplate("status_id", "reference %s" % tablename, @@ -799,7 +799,7 @@ def model(self): msg_list_empty = T("No Activities currently registered"), ) - # Reusable field + # Foreign Key Template if case_activity_subject: label = T("Subject") show_as = "subject" @@ -867,7 +867,7 @@ def model(self): msg_list_empty = T("No Update Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) update_type_id = FieldTemplate("update_type_id", "reference %s" % tablename, @@ -1067,7 +1067,7 @@ def model(self): msg_list_empty = T("No Appointment Types currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) appointment_type_id = FieldTemplate("type_id", "reference %s" % tablename, label = T("Appointment Type"), @@ -1241,7 +1241,7 @@ def model(self): msg_list_empty = T("No Need Types found"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) need_id = FieldTemplate("need_id", "reference %s" % tablename, label = T("Need Type"), @@ -1344,7 +1344,7 @@ def model(self): # CRUD strings crud_strings[tablename] = br_crud_strings(tablename) - # Reusable field + # Foreign Key Template themes_represent = br_AssistanceThemeRepresent(multiple=True) requires = IS_ONE_OF(db, "%s.id" % tablename, themes_represent, @@ -1397,7 +1397,7 @@ def model(self): msg_list_empty = T("No Types of Assistance currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) assistance_type_id = FieldTemplate( "assistance_type_id", @@ -1463,7 +1463,7 @@ def model(self): msg_list_empty = T("No Assistance Statuses currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) assistance_status_id = FieldTemplate( "status_id", @@ -2280,7 +2280,7 @@ def model(self): msg_list_empty = T("No Assistance Offers currently registered"), ) - # Reusable field + # Foreign Key Template if refno: represent = S3Represent(lookup=tablename, fields = ["refno", "name"], @@ -2606,7 +2606,7 @@ def model(self): msg_list_empty = T("No Service Contact Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) contact_type_id = FieldTemplate("contact_type_id", "reference %s" % tablename, label = T("Contact Type"), @@ -2752,7 +2752,7 @@ def model(self): msg_list_empty = T("No Note Types found"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) note_type_id = FieldTemplate("note_type_id", "reference %s" % tablename, label = T("Note Type"), diff --git a/modules/s3db/budget.py b/modules/s3db/budget.py index a6800574bd..831fee54ba 100644 --- a/modules/s3db/budget.py +++ b/modules/s3db/budget.py @@ -191,7 +191,7 @@ def model(self): # Represent #budget_budget_represent = S3Represent(lookup=tablename, show_link=True) - # Reusable Field + # Foreign Key Template #budget_budget_id = FieldTemplate("budget_id", "reference %s" % tablename, # label = T("Budget"), # ondelete = "CASCADE", @@ -299,7 +299,7 @@ def model(self): budget_location_represent = S3Represent(lookup=tablename, fields=["code"]) - # Reusable Field + # Foreign Key Template budget_location_id = FieldTemplate("location_id", "reference %s" % tablename, label = T("Location"), ondelete = "CASCADE", @@ -382,7 +382,7 @@ def model(self): budget_staff_represent = S3Represent(lookup=tablename, fields=["name"]) - # Reusable Field + # Foreign Key Template budget_staff_id = FieldTemplate("staff_id", "reference %s" % tablename, label = T("Staff"), ondelete = "RESTRICT", @@ -629,7 +629,7 @@ def model(self): # Represent budget_kit_represent = S3Represent(lookup=tablename, fields=["code"]) - # Reusable Field + # Foreign Key Template budget_kit_id = FieldTemplate("kit_id", "reference %s" % tablename, ondelete = "RESTRICT", label = T("Kit"), @@ -755,7 +755,7 @@ def model(self): budget_item_represent = S3Represent(lookup=tablename, fields=["description"]) - # Reusable Field + # Foreign Key Template budget_item_id = FieldTemplate("item_id", "reference %s" % tablename, label = T("Item"), ondelete = "RESTRICT", @@ -1008,7 +1008,7 @@ def model(self): budget_bundle_represent = S3Represent(lookup=tablename, fields=["name"]) - # Reusable Field + # Foreign Key Template budget_bundle_id = FieldTemplate("bundle_id", "reference %s" % tablename, label = T("Bundle"), ondelete = "RESTRICT", diff --git a/modules/s3db/cap.py b/modules/s3db/cap.py index 15154d2b78..484b937e78 100644 --- a/modules/s3db/cap.py +++ b/modules/s3db/cap.py @@ -718,7 +718,7 @@ def model(self): field_sep = " - ", ) - # Reusable Field + # Foreign Key Template alert_id = FieldTemplate("alert_id", "reference %s" % tablename, comment = T("The alert message containing this information"), label = T("Alert"), @@ -1368,7 +1368,7 @@ def model(self): fields = ["language", "headline"], field_sep = " - ") - # Reusable Field + # Foreign Key Template info_id = FieldTemplate("info_id", "reference %s" % tablename, label = T("Information Segment"), ondelete = "CASCADE", @@ -1940,7 +1940,7 @@ def model(self): # Reference Representation area_represent = cap_AreaRepresent(show_link=True) - # Reusable Field + # Foreign Key Template area_id = FieldTemplate("area_id", "reference %s" % tablename, label = T("Area"), ondelete = "CASCADE", @@ -2719,7 +2719,7 @@ def model(self): msg_list_empty = T("No Warning Classifications currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) priority_id = FieldTemplate("priority", "reference %s" % tablename, label = T("Priority"), @@ -3115,7 +3115,7 @@ def model(self): field_sep = " - ", ) - # Reusable Field + # Foreign Key Template alert_history_id = FieldTemplate("alert_history_id", "reference %s" % tablename, label = T("Alert History"), ondelete = "CASCADE", @@ -3388,7 +3388,7 @@ def model(self): field_sep = " - ", ) - # Reusable Field + # Foreign Key Template info_history_id = FieldTemplate("info_history_id", "reference %s" % tablename, label = T("Information History Segment"), ondelete = "CASCADE", @@ -3543,7 +3543,7 @@ def model(self): msg_list_empty = T("No areas currently defined for this alert"), ) - # Reusable Field + # Foreign Key Template represent = cap_AreaRepresent(show_link=True) area_history_id = FieldTemplate("area_history_id", "reference %s" % tablename, label = T("Area"), @@ -3854,7 +3854,7 @@ def model(self): msg_list_empty = T("No Alerting Authority available"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup = tablename, fields = ["organisation_id", "oid"], field_sep = " - ", diff --git a/modules/s3db/cms.py b/modules/s3db/cms.py index 9ccc359e9c..0541ba448c 100644 --- a/modules/s3db/cms.py +++ b/modules/s3db/cms.py @@ -151,7 +151,7 @@ def model(self): msg_record_deleted = T("Series deleted"), msg_list_empty = T("No series currently defined")) - # Reusable field + # Foreign Key Template translate = settings.get_L10n_translate_cms_series() represent = S3Represent(lookup=tablename, translate=translate) series_id = FieldTemplate("series_id", "reference %s" % tablename, @@ -207,7 +207,7 @@ def model(self): msg_record_deleted = T("Status deleted"), msg_list_empty = T("No Statuses currently registered")) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) #none = T("Unknown")) status_id = FieldTemplate("status_id", "reference %s" % tablename, @@ -333,7 +333,7 @@ def body_represent(body): msg_record_deleted = T("Post deleted"), msg_list_empty = T("No posts currently available")) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) post_id = FieldTemplate("post_id", "reference %s" % tablename, label = T("Post"), @@ -601,7 +601,7 @@ def body_represent(body): msg_record_deleted = T("Tag deleted"), msg_list_empty = T("No tags currently defined")) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) tag_id = FieldTemplate("tag_id", "reference %s" % tablename, label = T("Tag"), diff --git a/modules/s3db/cr.py b/modules/s3db/cr.py index ba3f070596..94bf244489 100644 --- a/modules/s3db/cr.py +++ b/modules/s3db/cr.py @@ -432,7 +432,7 @@ def model(self): msg_list_empty = T("No Shelters currently registered"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) shelter_id = FieldTemplate("shelter_id", "reference %s" % tablename, label = SHELTER_LABEL, @@ -878,7 +878,7 @@ def model(self): msg_list_empty = T("No Housing Units currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup="cr_shelter_unit") shelter_unit_id = FieldTemplate("shelter_unit_id", "reference cr_shelter_unit", label = T("Housing Unit"), @@ -1357,7 +1357,7 @@ def model(self): msg_list_empty = T("No Shelter Flags currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) flag_id = FieldTemplate("flag_id", "reference %s" % tablename, label = T("Shelter Flag"), diff --git a/modules/s3db/deploy.py b/modules/s3db/deploy.py index fb3bcde906..3ca0f0c289 100644 --- a/modules/s3db/deploy.py +++ b/modules/s3db/deploy.py @@ -326,7 +326,7 @@ def model(self): msg_record_deleted = T("Mission deleted"), msg_list_empty = T("No Missions currently registered")) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup = tablename, linkto = URL(f="mission", args=["[id]", "profile"]), @@ -1000,7 +1000,7 @@ def model(self): action = self.deploy_alert_send, ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) alert_id = FieldTemplate("alert_id", "reference %s" % tablename, label = T("Alert"), diff --git a/modules/s3db/disease.py b/modules/s3db/disease.py index baf2782f96..83a932a65e 100644 --- a/modules/s3db/disease.py +++ b/modules/s3db/disease.py @@ -252,7 +252,7 @@ def model(self): msg_list_empty = T("No Testing Devices currently registered"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) device_id = FieldTemplate("device_id", "reference %s" % tablename, label = T("Testing Device"), @@ -423,7 +423,7 @@ def model(self): msg_list_empty = T("No Demographics currently defined"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename) demographic_id = FieldTemplate("demographic_id", "reference %s" % tablename, label = T("Demographic"), @@ -1064,7 +1064,7 @@ def model(self): CommentsField(), ) - # Reusable Field + # Foreign Key Template represent = disease_CaseRepresent() case_id = FieldTemplate("case_id", "reference %s" % tablename, label = T("Case"), diff --git a/modules/s3db/doc.py b/modules/s3db/doc.py index 57142e518f..819abf6962 100644 --- a/modules/s3db/doc.py +++ b/modules/s3db/doc.py @@ -247,7 +247,7 @@ def model(self): super_entity = "stats_source", ) - # Reusable field (e.g. for link tables) + # Foreign Key Template (e.g. for link tables) represent = doc_DocumentRepresent(lookup = tablename, fields = ("name", "file", "url"), labels = "%(name)s", diff --git a/modules/s3db/dvi.py b/modules/s3db/dvi.py index f47f8d9ffc..d31f056f25 100644 --- a/modules/s3db/dvi.py +++ b/modules/s3db/dvi.py @@ -148,7 +148,7 @@ def model(self): "status" ]) - # Reusable fields + # Foreign Key Template represent = S3Represent(lookup="dvi_recreq", fields = ["marker", "date", "bodies_found"], labels = T("[%(marker)s] %(date)s: %(bodies_found)s bodies"), @@ -193,7 +193,7 @@ def model(self): ), ) - # Reusable Field + # Foreign Key Template morgue_id = FieldTemplate("morgue_id", "reference %s" % tablename, requires = IS_EMPTY_OR( IS_ONE_OF(db, "dvi_morgue.id", diff --git a/modules/s3db/dvr.py b/modules/s3db/dvr.py index 91a9dd30bc..214f5cbbb6 100644 --- a/modules/s3db/dvr.py +++ b/modules/s3db/dvr.py @@ -216,7 +216,7 @@ def model(self): onaccept = self.case_status_onaccept, ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) status_id = FieldTemplate("status_id", "reference %s" % tablename, label = T("Status"), @@ -512,7 +512,7 @@ def model(self): super_entity = ("doc_entity",), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, fields=("reference",)) case_id = FieldTemplate("case_id", "reference %s" % tablename, label = label, @@ -1036,7 +1036,7 @@ def model(self): msg_list_empty = T("No Case Flags found"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) flag_id = FieldTemplate("flag_id", "reference %s" % tablename, label = T("Case Flag"), @@ -1159,7 +1159,7 @@ def model(self): msg_list_empty = T("No Need Types found"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) need_id = FieldTemplate("need_id", "reference %s" % tablename, label = T("Need Type"), @@ -1258,7 +1258,7 @@ def model(self): # deduplicate = S3Duplicate(), # ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) note_type_id = FieldTemplate("note_type_id", "reference %s" % tablename, label = T("Note Type"), @@ -1373,7 +1373,7 @@ def model(self): msg_list_empty = T("No Referral Types found"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) referral_type_id = FieldTemplate("referral_type_id", "reference %s" % tablename, @@ -1488,7 +1488,7 @@ def model(self): msg_list_empty = T("No Response Themes currently defined"), ) - # Reusable field + # Foreign Key Template themes_represent = dvr_ResponseThemeRepresent(multiple = True, translate = True, ) @@ -1589,7 +1589,7 @@ def model(self): msg_list_empty = T("No Response Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) response_type_id = FieldTemplate( "response_type_id", @@ -1669,7 +1669,7 @@ def model(self): msg_list_empty = T("No Response Statuses currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) response_status_id = FieldTemplate( "status_id", @@ -2605,7 +2605,7 @@ def model(self): msg_list_empty = T("No Provider Types currently defined"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename) provider_type_id = FieldTemplate("provider_type_id", "reference %s" % tablename, label = T("Provider Type"), @@ -2657,7 +2657,7 @@ def model(self): msg_list_empty = T("No Termination Types currently defined"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename) termination_type_id = FieldTemplate("termination_type_id", "reference %s" % tablename, label = T("Termination Type"), @@ -2714,7 +2714,7 @@ def model(self): msg_list_empty = T("No Activity Statuses currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) activity_status_id = FieldTemplate("status_id", "reference %s" % tablename, @@ -3099,7 +3099,7 @@ def model(self): msg_list_empty = T("No Activities currently registered"), ) - # Reusable field + # Foreign Key Template represent = dvr_CaseActivityRepresent(show_link=True) case_activity_id = FieldTemplate("case_activity_id", "reference %s" % tablename, @@ -3142,7 +3142,7 @@ def model(self): msg_list_empty = T("No Update Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) update_type_id = FieldTemplate("update_type_id", "reference %s" % tablename, @@ -3605,7 +3605,7 @@ def model(self): msg_list_empty = T("No Appointment Types currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) appointment_type_id = FieldTemplate("type_id", "reference %s" % tablename, label = T("Appointment Type"), @@ -3987,7 +3987,7 @@ def model(self): msg_list_empty = T("No Residence Status Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) status_type_id = FieldTemplate("status_type_id", "reference %s" % tablename, @@ -4030,7 +4030,7 @@ def model(self): msg_list_empty = T("No Residence Permit Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) permit_type_id = FieldTemplate("permit_type_id", "reference %s" % tablename, @@ -4500,7 +4500,7 @@ def model(self): msg_list_empty = T("No Event Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) event_type_id = FieldTemplate("type_id", "reference %s" % tablename, label = T("Event Type"), @@ -5158,7 +5158,7 @@ def model(self): msg_list_empty = T("No Diagnoses currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) diagnosis_id = FieldTemplate("diagnosis_id", "reference %s" % tablename, @@ -5254,7 +5254,7 @@ def model(self): msg_list_empty = T("No Service Contact Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) type_id = FieldTemplate("type_id", "reference %s" % tablename, label = T("Service Contact Type"), diff --git a/modules/s3db/event.py b/modules/s3db/event.py index 47aa77c6d5..651d694391 100644 --- a/modules/s3db/event.py +++ b/modules/s3db/event.py @@ -2883,7 +2883,7 @@ def model(self): # method = "send", # action = self.event_alert_send) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) alert_id = FieldTemplate("alert_id", "reference %s" % tablename, label = T("Alert"), diff --git a/modules/s3db/fin.py b/modules/s3db/fin.py index fbaf54ec4a..5114dabc38 100644 --- a/modules/s3db/fin.py +++ b/modules/s3db/fin.py @@ -329,7 +329,7 @@ def model(self): msg_list_empty = T("No Programs currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup = tablename) program_id = FieldTemplate("program_id", "reference %s" % tablename, label = T("Program"), @@ -428,7 +428,7 @@ def model(self): onaccept = self.billing_onaccept, ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup = tablename, fields = ["date"], labels = lambda row: S3DateTime.date_represent(row.date, @@ -654,7 +654,7 @@ def model(self): msg_list_empty = T("No Invoices currently registered"), ) - # Reusable field + # Foreign Key Template represent = fin_VoucherInvoiceRepresent() invoice_id = FieldTemplate("invoice_id", "reference %s" % tablename, label = T("Invoice"), @@ -819,7 +819,7 @@ def model(self): msg_list_empty = T("No Compensation Claims currently registered"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, fields=["refno", "date"]) claim_id = FieldTemplate("claim_id", "reference %s" % tablename, label = T("Compensation Claim"), @@ -983,7 +983,7 @@ def model(self): msg_list_empty = T("No Vouchers currently registered"), ) - # Reusable field + # Foreign Key Template voucher_id = FieldTemplate("voucher_id", "reference %s" % tablename, ondelete = "RESTRICT", requires = IS_ONE_OF(db, "%s.id" % tablename), @@ -1093,7 +1093,7 @@ def model(self): msg_list_empty = T("No Accepted Vouchers currently registered"), ) - # Reusable field + # Foreign Key Template debit_id = FieldTemplate("debit_id", "reference %s" % tablename, ondelete = "RESTRICT", requires = IS_ONE_OF(db, "%s.id" % tablename), diff --git a/modules/s3db/gis.py b/modules/s3db/gis.py index 31fde08af9..f199ba39fb 100644 --- a/modules/s3db/gis.py +++ b/modules/s3db/gis.py @@ -313,7 +313,7 @@ def model(self): msg_record_deleted = T("Location deleted"), msg_list_empty = T("No Locations currently available")) - # Reusable field to include in other table definitions + # Foreign Key Template to include in other table definitions location_id = FieldTemplate("location_id", "reference %s" % tablename, label = T("Location"), ondelete = "RESTRICT", @@ -1702,7 +1702,7 @@ def model(self): msg_record_deleted = T("Marker deleted"), msg_list_empty = T("No Markers currently available")) - # Reusable field to include in other table definitions + # Foreign Key Template to include in other table definitions # @ToDo: Widget to include icons in dropdown: http://jqueryui.com/selectmenu/#custom_render marker_represent = gis_MarkerRepresent() marker_id = FieldTemplate("marker_id", "reference %s" % tablename, @@ -1798,7 +1798,7 @@ def model(self): msg_record_deleted = T("Projection deleted"), msg_list_empty = T("No Projections currently defined")) - # Reusable field to include in other table definitions + # Foreign Key Template to include in other table definitions represent = S3Represent(lookup=tablename) projection_id = FieldTemplate("projection_id", "reference %s" % tablename, sortby="name", @@ -1967,7 +1967,7 @@ def model(self): ), ) - # Reusable field - used by Events & Scenarios + # Foreign Key Template - used by Events & Scenarios represent = S3Represent(lookup=tablename) config_id = FieldTemplate("config_id", "reference %s" % tablename, label = T("Map Profile"), @@ -2731,7 +2731,7 @@ def model(self): #Field("sld", "text"), ) - # Reusable field + # Foreign Key Template #represent = S3Represent(lookup=tablename) #style_id = FieldTemplate("style_id", "reference %s" % tablename, # label = T("Map Style"), diff --git a/modules/s3db/hms.py b/modules/s3db/hms.py index 9b1ab34ecf..bd53a00f27 100644 --- a/modules/s3db/hms.py +++ b/modules/s3db/hms.py @@ -365,7 +365,7 @@ def model(self): super_entity = ("org_site", "doc_entity", "pr_pentity"), ) - # Reusable field + # Foreign Key Template hms_hospital_id_comment = S3PopupLink(c = "hms", f = "hospital", label = ADD_HOSPITAL, diff --git a/modules/s3db/inv.py b/modules/s3db/inv.py index 74b2923a13..2ae90ae0f9 100644 --- a/modules/s3db/inv.py +++ b/modules/s3db/inv.py @@ -562,7 +562,7 @@ def model(self): msg_record_deleted = T("Stock removed from Warehouse"), msg_list_empty = T("No Stock currently registered in this Warehouse")) - # Reusable Field + # Foreign Key Template inv_item_represent = inv_InvItemRepresent() inv_item_id = FieldTemplate("inv_item_id", "reference %s" % tablename, label = INV_ITEM, @@ -1230,7 +1230,7 @@ def model(self): msg_record_deleted = T("Sent Shipment canceled"), msg_list_empty = T("No Sent Shipments")) - # Reusable Field + # Foreign Key Template send_id = FieldTemplate("send_id", "reference %s" % tablename, label = T("Send Shipment"), ondelete = "RESTRICT", @@ -1450,7 +1450,7 @@ def model(self): else: recv_id_label = T("Receive Shipment") - # Reusable Field + # Foreign Key Template inv_recv_represent = self.inv_recv_represent recv_id = FieldTemplate("recv_id", "reference %s" % tablename, label = recv_id_label, @@ -3961,7 +3961,7 @@ def model(self): inv_adj_item = "adj_id", ) - # Reusable Field + # Foreign Key Template adj_id = FieldTemplate("adj_id", "reference %s" % tablename, label = T("Inventory Adjustment"), ondelete = "RESTRICT", @@ -4099,7 +4099,7 @@ def model(self): CommentsField(), ) - # Reusable Field + # Foreign Key Template adj_item_id = FieldTemplate("adj_item_id", "reference %s" % tablename, label = T("Inventory Adjustment Item"), ondelete = "RESTRICT", diff --git a/modules/s3db/msg.py b/modules/s3db/msg.py index 7e860e1a4f..d99cbde6b9 100644 --- a/modules/s3db/msg.py +++ b/modules/s3db/msg.py @@ -119,7 +119,7 @@ def model(self): ], ) - # Reusable Field + # Foreign Key Template channel_id = FieldTemplate("channel_id", "reference %s" % tablename, label = T("Channel"), ondelete = "SET NULL", @@ -436,7 +436,7 @@ def model(self): ], ) - # Reusable Field + # Foreign Key Template message_represent = S3Represent(lookup = tablename, fields = ["body"]) message_id = FieldTemplate("message_id", "reference %s" % tablename, ondelete = "RESTRICT", @@ -2301,7 +2301,7 @@ def model(self): ], ) - # Reusable Query ID + # Foreign Key Template represent = S3Represent(lookup=tablename, fields=["keywords"]) search_id = FieldTemplate("search_id", "reference %s" % tablename, label = T("Search Query"), diff --git a/modules/s3db/org.py b/modules/s3db/org.py index c08d49f1f0..693c70e103 100644 --- a/modules/s3db/org.py +++ b/modules/s3db/org.py @@ -542,7 +542,7 @@ def model(self): else: text_comment = T("You can search by name, acronym or comments") - # Reusable field + # Foreign Key Template organisation_comment = S3PopupLink(c = "org", f = "organisation", label = ADD_ORGANIZATION, @@ -2398,7 +2398,7 @@ def model(self): msg_record_deleted = T("Service deleted"), msg_list_empty = T("No Services currently registered")) - # Reusable Field + # Foreign Key Template service_id = FieldTemplate("service_id", "reference %s" % tablename, label = T("Services"), ondelete = "CASCADE", @@ -2638,7 +2638,7 @@ def model(self): }, ) - # Reusable field + # Foreign Key Template service_location_id = FieldTemplate("service_location_id", "reference %s" % tablename, ondelete = "CASCADE", @@ -2693,7 +2693,7 @@ def model(self): msg_record_deleted = T("Booking Mode deleted"), msg_list_empty = T("No Booking Modes currently defined")) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) booking_mode_id = FieldTemplate("booking_mode_id", "reference %s" % tablename, @@ -2738,7 +2738,7 @@ def model(self): msg_record_deleted = T("Service Mode deleted"), msg_list_empty = T("No Service Modes currently defined")) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) service_mode_id = FieldTemplate("service_mode_id", "reference %s" % tablename, @@ -4927,7 +4927,7 @@ def model(self): })''') ) - # Reusable field for other tables to reference + # Foreign Key Template for other tables to reference represent = S3Represent(lookup=tablename) room_id = FieldTemplate("room_id", "reference %s" % tablename, label = T("Room"), diff --git a/modules/s3db/patient.py b/modules/s3db/patient.py index 29f276feb9..cb34560064 100644 --- a/modules/s3db/patient.py +++ b/modules/s3db/patient.py @@ -109,7 +109,7 @@ def model(self): patient_represent = patient_PatientRepresent(lookup = "patient_patient") - # Reusable Field for Component Link + # Foreign Key Template for Component Link patient_id = FieldTemplate("patient_id", "reference %s" % tablename, ondelete = "RESTRICT", represent = patient_represent, diff --git a/modules/s3db/pr.py b/modules/s3db/pr.py index 60669d15de..70fdfa1597 100644 --- a/modules/s3db/pr.py +++ b/modules/s3db/pr.py @@ -298,7 +298,7 @@ def model(self): gis_config = pe_id, ) - # Reusable fields + # Foreign Key Template pr_pe_label = FieldTemplate("pe_label", length=128, label = T("ID Tag Number"), requires = IS_EMPTY_OR( @@ -394,7 +394,7 @@ def model(self): pr_affiliation = "role_id", ) - # Reusable fields + # Foreign Key Template pr_role_represent = pr_RoleRepresent() role_id = FieldTemplate("role_id", "reference %s" % tablename, label = T("Role"), @@ -2263,7 +2263,7 @@ def model(self): ), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) status_id = FieldTemplate("status_id", "reference %s" % tablename, comment = S3PopupLink(c = "pr", @@ -2376,7 +2376,7 @@ def model(self): ), ) - # Reusable field + # Foreign Key Template if current.request.controller in ("hrm", "vol") and \ current.deployment_settings.get_hrm_teams() == "Teams": label = T("Team") @@ -2526,7 +2526,7 @@ def model(self): ), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) role_id = FieldTemplate("role_id", "reference %s" % tablename, comment = S3PopupLink(c = "pr", @@ -2959,7 +2959,7 @@ def model(self): super_entity = ("pr_pentity"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) forum_id = FieldTemplate("forum_id", "reference %s" % tablename, sortby = "name", @@ -5425,7 +5425,7 @@ def model(self): msg_list_empty = T("No Occupation Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup = tablename, translate = True, ) diff --git a/modules/s3db/project.py b/modules/s3db/project.py index d087c027b7..838b266af6 100644 --- a/modules/s3db/project.py +++ b/modules/s3db/project.py @@ -384,7 +384,7 @@ def model(self): update_realm = True, ) - # Reusable Field + # Foreign Key Template if use_codes: project_represent = S3Represent(lookup=tablename, field_sep = ": ", @@ -1110,7 +1110,7 @@ def model(self): super_entity = "stats_data", ) - # Reusable Field + # Foreign Key Template beneficiary_id = FieldTemplate("beneficiary_id", "reference %s" % tablename, label = T("Beneficiaries"), ondelete = "SET NULL", @@ -1288,7 +1288,7 @@ def model(self): msg_list_empty = T("No Hazards currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) hazard_id = FieldTemplate("hazard_id", "reference %s" % tablename, sortby = "name", @@ -1677,7 +1677,7 @@ def model(self): }, ) - # Reusable Field + # Foreign Key Template project_location_represent = project_LocationRepresent() project_location_id = FieldTemplate("project_location_id", "reference %s" % tablename, label = LOCATION, @@ -2178,7 +2178,7 @@ def model(self): msg_list_empty = T("No Statuses currently defined"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) status_id = FieldTemplate("status_id", "reference %s" % tablename, comment = S3PopupLink(title = ADD_STATUS, @@ -2305,7 +2305,7 @@ def model(self): msg_list_empty = T("No Themes currently registered"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) theme_id = FieldTemplate("theme_id", "reference %s" % tablename, label = T("Theme"), @@ -2786,7 +2786,7 @@ def model(self): update_realm = True, ) - # Reusable Field + # Foreign Key Template activity_id = FieldTemplate("activity_id", "reference %s" % tablename, comment = S3PopupLink(ADD_ACTIVITY, c = "project", @@ -3102,7 +3102,7 @@ def model(self): msg_list_empty = T("No Activity Types Found"), ) - # Reusable Fields + # Foreign Key Templates represent = S3Represent(lookup=tablename, translate=True) activity_type_id = FieldTemplate("activity_type_id", "reference %s" % tablename, label = T("Activity Type"), @@ -3472,7 +3472,7 @@ def model(self): msg_list_empty = T("No Milestones Found"), ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename, fields=["name", "date"], labels="%(name)s: %(date)s", @@ -3830,7 +3830,7 @@ def model(self): update_onaccept = self.project_task_update_onaccept, ) - # Reusable field + # Foreign Key Template represent = project_TaskRepresent(show_link=True) task_id = FieldTemplate("task_id", "reference %s" % tablename, label = T("Task"), diff --git a/modules/s3db/req.py b/modules/s3db/req.py index a853a7b19d..406d3684e6 100644 --- a/modules/s3db/req.py +++ b/modules/s3db/req.py @@ -589,7 +589,7 @@ def model(self): # @ToDo: id gets stripped in _select_field fact_fields = report_fields + [(T("Requests"), "id")] - # Reusable Field + # Foreign Key Template represent = self.req_represent req_id = FieldTemplate("req_id", "reference %s" % tablename, label = T("Request"), @@ -1837,7 +1837,7 @@ def model(self): msg_record_deleted = T("Item(s) deleted from Request"), msg_list_empty = T("No Items currently requested")) - # Reusable Field + # Foreign Key Template req_item_represent = req_ReqItemRepresent() req_item_id = FieldTemplate("req_item_id", "reference %s" % tablename, label = T("Request Item"), @@ -3592,7 +3592,7 @@ def model(self): msg_record_deleted = T("Commitment Canceled"), msg_list_empty = T("No Commitments")) - # Reusable Field + # Foreign Key Template commit_represent = req_CommitRepresent() commit_id = FieldTemplate("commit_id", "reference %s" % tablename, label = T("Commitment"), diff --git a/modules/s3db/s3.py b/modules/s3db/s3.py index 717ce21b1e..a23c581df9 100644 --- a/modules/s3db/s3.py +++ b/modules/s3db/s3.py @@ -299,7 +299,7 @@ def model(self): msg_list_empty = T("No Tables currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, show_link=True) table_id = FieldTemplate("table_id", "reference %s" % tablename, label = T("Table"), @@ -427,7 +427,7 @@ def model(self): msg_list_empty = T("No Fields currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, show_link=True) field_id = FieldTemplate("field_id", "reference %s" % tablename, label = T("Field"), diff --git a/modules/s3db/security.py b/modules/s3db/security.py index 34d1b9f4e2..5dfe753eb6 100644 --- a/modules/s3db/security.py +++ b/modules/s3db/security.py @@ -392,7 +392,7 @@ def model(self): msg_list_empty = T("No Item Types currently defined"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, translate=True) item_type_id = FieldTemplate("item_type_id", "reference %s" % tablename, label = T("Type"), @@ -444,7 +444,7 @@ def model(self): msg_list_empty = T("No Depositories currently registered"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename) depository_id = FieldTemplate("depository_id", "reference %s" % tablename, label = T("Depository"), diff --git a/modules/s3db/stats.py b/modules/s3db/stats.py index 0b5af07700..b06a31fa2b 100644 --- a/modules/s3db/stats.py +++ b/modules/s3db/stats.py @@ -1365,7 +1365,7 @@ def model(self): ), ] - # Reusable Field + # Foreign Key Template impact_id = FieldTemplate("impact_id", "reference %s" % tablename, label = T("Impact"), ondelete = "CASCADE", diff --git a/modules/s3db/supply.py b/modules/s3db/supply.py index 48324b2448..b6cb96d86a 100644 --- a/modules/s3db/supply.py +++ b/modules/s3db/supply.py @@ -155,7 +155,7 @@ def model(self): msg_record_deleted = T("Brand deleted"), msg_list_empty = T("No Brands currently registered")) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup=tablename) brand_id = FieldTemplate("brand_id", "reference %s" % tablename, label = T("Brand"), @@ -208,7 +208,7 @@ def model(self): msg_record_deleted = T("Catalog deleted"), msg_list_empty = T("No Catalogs currently registered")) - # Reusable Field + # Foreign Key Template catalog_multi = settings.get_supply_catalog_multi() if catalog_multi: comment = S3PopupLink(c = "supply", @@ -329,7 +329,7 @@ def model(self): msg_record_deleted = T("Item Category deleted"), msg_list_empty = T("No Item Categories currently registered")) - # Reusable Field + # Foreign Key Template item_category_comment = S3PopupLink(c = "supply", f = "item_category", label = ADD_ITEM_CATEGORY, @@ -494,7 +494,7 @@ def model(self): supply_item_represent = supply_ItemRepresent(show_link = True, translate = translate) - # Reusable Field + # Foreign Key Template supply_item_tooltip = T("Type the name of an existing catalog item OR Click 'Create Item' to add an item which is not in the catalog.") supply_item_id = FieldTemplate("item_id", "reference %s" % tablename, # 'item_id' for backwards-compatibility @@ -737,7 +737,7 @@ def model(self): msg_list_empty = T("No Item Packs currently registered")) # --------------------------------------------------------------------- - # Reusable Field + # Foreign Key Template item_pack_represent = supply_ItemPackRepresent(lookup = "supply_item_pack", translate = translate) item_pack_id = FieldTemplate("item_pack_id", "reference %s" % tablename, @@ -893,7 +893,7 @@ def model(self): ), *MetaFields.owner_meta_fields()) - # Reusable Field + # Foreign Key Template item_id = lambda: super_link("item_entity_id", "supply_item_entity", #writable = True, #readable = True, @@ -1404,7 +1404,7 @@ def model(self): msg_list_empty = T("No Distributions Found") ) - # Reusable Field + # Foreign Key Template #represent = S3Represent(lookup=tablename, # field_sep = " ", # fields=["value", "parameter_id"]) @@ -1821,7 +1821,7 @@ def model(self): msg_list_empty = T("No Statuses currently defined") ) - # Reusable Field + # Foreign Key Template represent = S3Represent(lookup = tablename) status_id = FieldTemplate("status_id", "reference %s" % tablename, label = T("Status"), diff --git a/modules/s3db/sync.py b/modules/s3db/sync.py index 9e4e14d2dd..9dedc64c9b 100644 --- a/modules/s3db/sync.py +++ b/modules/s3db/sync.py @@ -389,7 +389,7 @@ def model(self): action = sync_job_reset, ) - # Reusable Fields + # Foreign Key Templates sync_repository_represent = S3Represent(lookup = tablename) repository_id = FieldTemplate("repository_id", "reference %s" % tablename, comment = S3PopupLink(c = "sync", @@ -659,7 +659,7 @@ def model(self): msg_list_empty = T("No Public Data Sets currently registered"), ) - # Reusable field + # Foreign Key Template represent = S3Represent(lookup=tablename, show_link=True) dataset_id = FieldTemplate("dataset_id", "reference %s" % tablename, label = T("Data Set"), @@ -1165,7 +1165,7 @@ def model(self): ), ) - # Reusable Field + # Foreign Key Template task_represent = self.sync_task_represent task_id = FieldTemplate("task_id", "reference %s" % tablename, label = T("Task"), diff --git a/modules/s3db/transport.py b/modules/s3db/transport.py index a4c761b7ae..f8c82649a0 100644 --- a/modules/s3db/transport.py +++ b/modules/s3db/transport.py @@ -689,7 +689,7 @@ def model(self): list_fields = list_fields, ) - # Reusable field + # Foreign Key Template represent = transport_BorderCrossingRepresent(show_link=True) border_crossing_id = FieldTemplate("border_crossing_id", "reference %s" % tablename, label = T("Border Crossing"), diff --git a/modules/templates/GIMS/models/cr.py b/modules/templates/GIMS/models/cr.py index f2a03ffe3e..840a7ab086 100644 --- a/modules/templates/GIMS/models/cr.py +++ b/modules/templates/GIMS/models/cr.py @@ -70,7 +70,7 @@ def model(self): define_table = self.define_table configure = self.configure - # Reusable field for population-type fields + # Field template for population-type fields population = FieldTemplate("population", "integer", default = 0, requires = IS_INT_IN_RANGE(0),