Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

started working on group_membership_type #1207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions controllers/pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ def postp(r, output):
response.title = module_name
return output

def group_membership_type():
""" Group Membership Type: RESTful CRUD Controller """

return s3_rest_controller()

# -----------------------------------------------------------------------------
def person():
""" RESTful CRUD controller """
Expand Down
44 changes: 43 additions & 1 deletion modules/s3db/pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,8 @@ class S3GroupModel(S3Model):

names = ("pr_group",
"pr_group_id",
"pr_group_membership"
"pr_group_membership",
"pr_group_membership_type",
)

def model(self):
Expand Down Expand Up @@ -2052,6 +2053,45 @@ def model(self):
},
)

# Case Appointment Type
#
tablename = "pr_group_membership_type"
define_table(tablename,
Field("name", length=64, notnull=True, unique=True,
requires = IS_NOT_EMPTY(),
),
Field("type", "integer",
requires = IS_NOT_EMPTY(),
),
s3_comments(),
*s3_meta_fields())

# CRUD Strings
crud_strings[tablename] = Storage(
label_create = T("Create Group Membership Type"),
title_display = T("Group Membership Type Details"),
title_list = T("Group Membership Types"),
title_update = T("Edit Group Membership Types"),
label_list_button = T("List Group Membership Types"),
label_delete_button = T("Delete Group Membership Type"),
msg_record_created = T("Group Membership Type added"),
msg_record_modified = T("Group Membership Type updated"),
msg_record_deleted = T("Group Membership Type deleted"),
msg_list_empty = T("No Group Membership Types currently registered"),
)

# Reusable Field
represent = S3Represent(lookup=tablename, translate=True)
group_membership_type_id = S3ReusableField("type_id", "reference %s" % tablename,
label = T("Group Membership Type"),
ondelete = "RESTRICT",
represent = represent,
requires = IS_EMPTY_OR(
IS_ONE_OF(db, "pr_group_membership_type.id",
represent,
)),
)

# ---------------------------------------------------------------------
# Group membership
#
Expand All @@ -2071,6 +2111,8 @@ def model(self):
represent = lambda group_head: \
(group_head and [T("yes")] or [""])[0]
),
group_membership_type_id(empty = False,
),
s3_comments(),
*s3_meta_fields())

Expand Down
1 change: 1 addition & 0 deletions modules/templates/DRK/tasks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ dvr,case_status,dvr_case_status.csv,case_status.xsl
dvr,case_appointment_type,dvr_case_appointment_type.csv,case_appointment_type.xsl
dvr,need,dvr_need.csv,need.xsl
# =============================================================================
pr,group_membership_type,group_membership_type.csv,group_membership_type.xsl