Browse Source

HOT-FIX: ajuste no crud

- inclui leitura customizada da origem do layouts.yaml
- corrige classes css em crud/detail.html
- ajusta leitura de hook field
pull/3372/head
Leandro Roberto 4 years ago
parent
commit
db3103a433
  1. 3
      sapl/crispy_layout_mixin.py
  2. 5
      sapl/crud/base.py
  3. 4
      sapl/templates/crud/detail.html

3
sapl/crispy_layout_mixin.py

@ -190,7 +190,8 @@ class CrispyLayoutFormMixin:
return getattr(obj.model,
obj.model_set).field.model.__name__
def get_layout(self):
def get_layout(self, yaml_layout=None):
if not yaml_layout:
yaml_layout = '%s/layouts.yaml' % self.model._meta.app_config.label
return read_layout_from_yaml(yaml_layout, self.layout_key)

5
sapl/crud/base.py

@ -467,12 +467,15 @@ class CrudListView(PermissionRequiredContainerCrudMixin, ListView):
break
ss = ''
try:
if m:
ss = get_field_display(m, n[-1])[1]
ss = (
('<br>' if '<ul>' in ss else ' - ') + ss)\
if ss and j != 0 and s else ss
except:
pass
finally:
hook = 'hook_{}'.format(''.join(n))
if hasattr(self, hook):
hs, url = getattr(self, hook)(obj, ss, url)

4
sapl/templates/crud/detail.html

@ -3,7 +3,7 @@
{% block base_content %}
<div class="context-actions clearfix">
<div class="d-flex context-actions justify-content-between align-items-center">
{% block actions %}
{% block sub_actions %}
@ -35,7 +35,7 @@
{% block extra_actions %}
{% endblock extra_actions %}
<div class="editons float-right">
<div class="editons">
{% block editions %}
{% if view.update_url or view.delete_url %}
<div class="actions btn-group" role="group">

Loading…
Cancel
Save