-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #8495: Enable custom field grouping
- Loading branch information
1 parent
4fac10a
commit 17df8a5
Showing
13 changed files
with
119 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.0.4 on 2022-04-15 17:13 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('extras', '0073_journalentry_tags_custom_fields'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='customfield', | ||
options={'ordering': ['group_name', 'weight', 'name']}, | ||
), | ||
migrations.AddField( | ||
model_name='customfield', | ||
name='group_name', | ||
field=models.CharField(blank=True, max_length=50), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,54 @@ | ||
{% load helpers %} | ||
|
||
{% with custom_fields=object.get_custom_fields %} | ||
{% if custom_fields %} | ||
<div class="card"> | ||
<h5 class="card-header">Custom Fields</h5> | ||
<div class="card-body"> | ||
<table class="table table-hover attr-table"> | ||
{% for field, value in custom_fields.items %} | ||
<tr> | ||
<td> | ||
<span title="{{ field.description|escape }}">{{ field }}</span> | ||
</td> | ||
<td> | ||
{% if field.type == 'integer' and value is not None %} | ||
{{ value }} | ||
{% elif field.type == 'longtext' and value %} | ||
{{ value|markdown }} | ||
{% elif field.type == 'boolean' and value == True %} | ||
{% checkmark value true="True" %} | ||
{% elif field.type == 'boolean' and value == False %} | ||
{% checkmark value false="False" %} | ||
{% elif field.type == 'url' and value %} | ||
<a href="{{ value }}">{{ value|truncatechars:70 }}</a> | ||
{% elif field.type == 'json' and value %} | ||
<pre>{{ value|json }}</pre> | ||
{% elif field.type == 'multiselect' and value %} | ||
{{ value|join:", " }} | ||
{% elif field.type == 'object' and value %} | ||
{{ value|linkify }} | ||
{% elif field.type == 'multiobject' and value %} | ||
{% for obj in value %} | ||
{{ obj|linkify }}{% if not forloop.last %}<br />{% endif %} | ||
{% endfor %} | ||
{% elif value %} | ||
{{ value }} | ||
{% elif field.required %} | ||
<span class="text-warning">Not defined</span> | ||
{% else %} | ||
<span class="text-muted">—</span> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
{% with custom_fields=object.get_custom_fields_by_group %} | ||
{% if custom_fields %} | ||
<div class="card"> | ||
<h5 class="card-header">Custom Fields</h5> | ||
<div class="card-body"> | ||
{% for group_name, fields in custom_fields.items %} | ||
{% if group_name %} | ||
<h6><strong>{{ group_name }}</strong></h6> | ||
{% endif %} | ||
<table class="table table-hover attr-table"> | ||
{% for field, value in fields.items %} | ||
<tr> | ||
<td> | ||
<span title="{{ field.description|escape }}">{{ field }}</span> | ||
</td> | ||
<td> | ||
{% if field.type == 'integer' and value is not None %} | ||
{{ value }} | ||
{% elif field.type == 'longtext' and value %} | ||
{{ value|markdown }} | ||
{% elif field.type == 'boolean' and value == True %} | ||
{% checkmark value true="True" %} | ||
{% elif field.type == 'boolean' and value == False %} | ||
{% checkmark value false="False" %} | ||
{% elif field.type == 'url' and value %} | ||
<a href="{{ value }}">{{ value|truncatechars:70 }}</a> | ||
{% elif field.type == 'json' and value %} | ||
<pre>{{ value|json }}</pre> | ||
{% elif field.type == 'multiselect' and value %} | ||
{{ value|join:", " }} | ||
{% elif field.type == 'object' and value %} | ||
{{ value|linkify }} | ||
{% elif field.type == 'multiobject' and value %} | ||
{% for obj in value %} | ||
{{ obj|linkify }}{% if not forloop.last %}<br />{% endif %} | ||
{% endfor %} | ||
</table> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% elif value %} | ||
{{ value }} | ||
{% elif field.required %} | ||
<span class="text-warning"><i class="mdi mdi-alert"></i> Not defined</span> | ||
{% else %} | ||
{{ ''|placeholder }} | ||
{% endif %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endwith %} |