customfield.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {% extends 'generic/object.html' %}
  2. {% load helpers %}
  3. {% load plugins %}
  4. {% load i18n %}
  5. {% block content %}
  6. <div class="row mb-3">
  7. <div class="col col-md-6">
  8. <div class="card">
  9. <h2 class="card-header">{% trans "Custom Field" %}</h2>
  10. <table class="table table-hover attr-table">
  11. <tr>
  12. <th scope="row">{% trans "Name" %}</th>
  13. <td>{{ object.name }}</td>
  14. </tr>
  15. <tr>
  16. <th scope="row">Type</th>
  17. <td>
  18. {{ object.get_type_display }}
  19. {% if object.related_object_type %}
  20. ({{ object.related_object_type.model|bettertitle }})
  21. {% endif %}
  22. </td>
  23. </tr>
  24. <tr>
  25. <th scope="row">{% trans "Label" %}</th>
  26. <td>{{ object.label|placeholder }}</td>
  27. </tr>
  28. <tr>
  29. <th scope="row">{% trans "Group Name" %}</th>
  30. <td>{{ object.group_name|placeholder }}</td>
  31. </tr>
  32. <tr>
  33. <th scope="row">{% trans "Description" %}</th>
  34. <td>{{ object.description|markdown|placeholder }}</td>
  35. </tr>
  36. <tr>
  37. <th scope="row">{% trans "Required" %}</th>
  38. <td>{% checkmark object.required %}</td>
  39. </tr>
  40. <tr>
  41. <th scope="row">{% trans "Must be Unique" %}</th>
  42. <td>{% checkmark object.unique %}</td>
  43. </tr>
  44. <tr>
  45. <th scope="row">{% trans "Cloneable" %}</th>
  46. <td>{% checkmark object.is_cloneable %}</td>
  47. </tr>
  48. {% if object.choice_set %}
  49. <tr>
  50. <th scope="row">{% trans "Choice Set" %}</th>
  51. <td>{{ object.choice_set|linkify }} ({{ object.choice_set.choices|length }} choices)</td>
  52. </tr>
  53. {% endif %}
  54. <tr>
  55. <th scope="row">{% trans "Default Value" %}</th>
  56. <td>{{ object.default }}</td>
  57. </tr>
  58. <tr>
  59. <th scope="row">{% trans "Related object filter" %}</th>
  60. {% if object.related_object_filter %}
  61. <td><pre>{{ object.related_object_filter|json }}</pre></td>
  62. {% else %}
  63. <td>{{ ''|placeholder }}</td>
  64. {% endif %}
  65. </tr>
  66. </table>
  67. </div>
  68. <div class="card">
  69. <h2 class="card-header">{% trans "Behavior" %}</h2>
  70. <table class="table table-hover attr-table">
  71. <tr>
  72. <th scope="row">{% trans "Search Weight" %}</th>
  73. <td>
  74. {% if object.search_weight %}
  75. {{ object.search_weight }}
  76. {% else %}
  77. <span class="text-muted">{% trans "Disabled" %}</span>
  78. {% endif %}
  79. </td>
  80. </tr>
  81. <tr>
  82. <th scope="row">{% trans "Filter Logic" %}</th>
  83. <td>{{ object.get_filter_logic_display }}</td>
  84. </tr>
  85. <tr>
  86. <th scope="row">{% trans "Display Weight" %}</th>
  87. <td>{{ object.weight }}</td>
  88. </tr>
  89. <tr>
  90. <th scope="row">{% trans "UI Visible" %}</th>
  91. <td>{{ object.get_ui_visible_display }}</td>
  92. </tr>
  93. <tr>
  94. <th scope="row">{% trans "UI Editable" %}</th>
  95. <td>{{ object.get_ui_editable_display }}</td>
  96. </tr>
  97. </table>
  98. </div>
  99. {% include 'inc/panels/comments.html' %}
  100. {% plugin_left_page object %}
  101. </div>
  102. <div class="col col-md-6">
  103. <div class="card">
  104. <h2 class="card-header">{% trans "Object Types" %}</h2>
  105. <table class="table table-hover attr-table">
  106. {% for ct in object.object_types.all %}
  107. <tr>
  108. <td>{{ ct }}</td>
  109. </tr>
  110. {% endfor %}
  111. </table>
  112. </div>
  113. <div class="card">
  114. <h2 class="card-header">{% trans "Validation Rules" %}</h2>
  115. <table class="table table-hover attr-table">
  116. <tr>
  117. <th scope="row">{% trans "Minimum Value" %}</th>
  118. <td>{{ object.validation_minimum|placeholder }}</td>
  119. </tr>
  120. <tr>
  121. <th scope="row">{% trans "Maximum Value" %}</th>
  122. <td>{{ object.validation_maximum|placeholder }}</td>
  123. </tr>
  124. <tr>
  125. <th scope="row">{% trans "Regular Expression" %}</th>
  126. <td>
  127. {% if object.validation_regex %}
  128. <code>{{ object.validation_regex }}</code>
  129. {% else %}
  130. {{ ''|placeholder }}
  131. {% endif %}
  132. </td>
  133. </tr>
  134. </table>
  135. </div>
  136. <div class="card">
  137. <h2 class="card-header">Related Objects</h2>
  138. <ul class="list-group list-group-flush" role="presentation">
  139. {% for qs in related_models %}
  140. <a class="list-group-item list-group-item-action d-flex justify-content-between">
  141. {{ qs.model|meta:"verbose_name_plural"|bettertitle }}
  142. {% with count=qs.count %}
  143. {% if count %}
  144. <span class="badge text-bg-primary rounded-pill">{{ count }}</span>
  145. {% else %}
  146. <span class="badge text-bg-light rounded-pill">&mdash;</span>
  147. {% endif %}
  148. {% endwith %}
  149. </a>
  150. {% endfor %}
  151. </ul>
  152. </div>
  153. {% plugin_right_page object %}
  154. </div>
  155. </div>
  156. <div class="row">
  157. <div class="col col-md-12">
  158. {% plugin_full_width_page object %}
  159. </div>
  160. </div>
  161. {% endblock %}