Skip to content

Commit

Permalink
rename field default to default_value
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Mar 8, 2024
1 parent cd41650 commit ae85c95
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions edc_data_manager/admin/data_dictionary_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DataDictionaryAdmin(ModelAdminSubjectDashboardMixin, SimpleHistoryAdmin):
"field_name",
"field_type",
"help_text",
"default",
"default_value",
"nullable",
"max_length",
"max_digits",
Expand All @@ -51,7 +51,7 @@ class DataDictionaryAdmin(ModelAdminSubjectDashboardMixin, SimpleHistoryAdmin):
"number",
"question_text",
"field_type",
"default",
"default_value",
"help_text",
"nullable",
"max_length",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.10 on 2024-03-07 15:11

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
(
"edc_data_manager",
"0037_alter_dataquery_site_alter_historicaldataquery_site_and_more",
),
]

operations = [
migrations.RenameField(
model_name="datadictionary",
old_name="default",
new_name="default_value",
),
migrations.RenameField(
model_name="historicaldatadictionary",
old_name="default",
new_name="default_value",
),
]
2 changes: 1 addition & 1 deletion edc_data_manager/models/data_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DataDictionary(BaseUuidModel):

nullable = models.BooleanField(null=True)

default = models.CharField(max_length=250, null=True)
default_value = models.CharField(max_length=250, null=True)

help_text = models.TextField(null=True)

Expand Down
2 changes: 2 additions & 0 deletions edc_data_manager/populate_data_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ def create_or_update_data_dictionary(index, model, fld):
label = fld.verbose_name
db_field_data = DbField(model, fld).__dict__
if db_field_data.get("field_name"):
default_value = db_field_data.pop("default")
options = dict(
active=True,
model=model._meta.label_lower,
number=index + 1,
prompt=format_html("{}", mark_safe(label or "")), # nosec B703, B308
default_value=default_value,
**db_field_data,
)
try:
Expand Down

0 comments on commit ae85c95

Please sign in to comment.