Skip to content

Commit

Permalink
Adjust comments for new terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Feb 26, 2024
1 parent 1455ddb commit a33ba94
Show file tree
Hide file tree
Showing 35 changed files with 138 additions and 138 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nursix-dev-5853-g4c80fdc2f (2024-02-22 16:43:37)
nursix-dev-5854-g1455ddb3f (2024-02-26 20:09:42)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Reusable Fields
Field Templates
===============

Common Field Functions
Expand All @@ -7,5 +7,5 @@ Common Field Functions
Meta-Fields
-----------

Implementing Reusable Fields
Implementing Field Templates
----------------------------
2 changes: 1 addition & 1 deletion docs/source/extend/models/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Implementing Data Models
Basic Concepts <basics>
Defining Tables <tables>
Table Configuration <configure>
Reusable Fields <reusablefield>
Field Templates <fieldtemplate>
Representation Methods <represent>

2 changes: 1 addition & 1 deletion models/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions modules/core/tools/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion modules/core/ui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion modules/s3db/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 12 additions & 12 deletions modules/s3db/br.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down
12 changes: 6 additions & 6 deletions modules/s3db/budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions modules/s3db/cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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 = " - ",
Expand Down
8 changes: 4 additions & 4 deletions modules/s3db/cms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions modules/s3db/cr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions modules/s3db/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Expand Down Expand Up @@ -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"),
Expand Down
Loading

0 comments on commit a33ba94

Please sign in to comment.