custom fields, url in new window, bulk edit/import support

This commit is contained in:
Jamie Murphy 2023-05-29 21:32:01 +01:00
parent 1eddade01e
commit 446ee761d3
5 changed files with 12 additions and 4 deletions

View File

@ -101,7 +101,7 @@ class CustomFieldSerializer(ValidatedModelSerializer):
'id', 'url', 'display', 'content_types', 'type', 'object_type', 'data_type', 'name', 'label', 'group_name',
'description', 'required', 'search_weight', 'filter_logic', 'ui_visibility', 'is_cloneable', 'default',
'weight', 'validation_minimum', 'validation_maximum', 'validation_regex', 'choices', 'created',
'last_updated',
'last_updated', 'new_window',
]
def validate_type(self, value):

View File

@ -48,6 +48,10 @@ class CustomFieldBulkEditForm(BulkEditForm):
required=False,
widget=BulkEditNullBooleanSelect()
)
new_window = forms.NullBooleanField(
required=False,
widget=BulkEditNullBooleanSelect()
)
nullable_fields = ('group_name', 'description',)

View File

@ -54,7 +54,7 @@ class CustomFieldImportForm(CSVModelForm):
fields = (
'name', 'label', 'group_name', 'type', 'content_types', 'object_type', 'required', 'description',
'search_weight', 'filter_logic', 'default', 'choices', 'weight', 'validation_minimum', 'validation_maximum',
'validation_regex', 'ui_visibility', 'is_cloneable',
'validation_regex', 'ui_visibility', 'is_cloneable', 'new_window',
)

View File

@ -162,7 +162,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
base_field=models.CharField(max_length=100),
blank=True,
null=True,
help_text=_('Comma-separated list of available choices (for selection fields)')
help_text=_('Comma-separated list of available choices (for url fields)')
)
ui_visibility = models.CharField(
max_length=50,
@ -178,7 +178,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
)
new_window = models.BooleanField(
default=False,
help_text=_("Force link to open in a new window")
help_text=_("Force link to open in a new window (for selection fields)")
)
objects = CustomFieldManager()

View File

@ -64,6 +64,10 @@
<th scope="row">Cloneable</th>
<td>{% checkmark object.is_cloneable %}</td>
</tr>
<tr>
<th scope="row">New Window</th>
<td>{% checkmark object.new_window %}</td>
</tr>
</table>
</div>
</div>