diff --git a/gas/templates/gas/base.html b/gas/templates/gas/base.html index 443ce1c..bfa13e7 100644 --- a/gas/templates/gas/base.html +++ b/gas/templates/gas/base.html @@ -74,6 +74,20 @@ {% endif %} {% endblock %} + {% block actions %} + {% if actions %} + + {% endif %} + {% endblock %} + {% block content %} {% endblock %} diff --git a/gas/templates/gas/base_form.html b/gas/templates/gas/base_form.html index abb2980..9751b5c 100644 --- a/gas/templates/gas/base_form.html +++ b/gas/templates/gas/base_form.html @@ -15,8 +15,10 @@ {% endfor %} {% endblock %} + {% block extra_form %}{% endblock %} + {% endblock %} diff --git a/gas/templates/gas/base_list.html b/gas/templates/gas/base_list.html index 4e1a1b3..1f0770d 100644 --- a/gas/templates/gas/base_list.html +++ b/gas/templates/gas/base_list.html @@ -4,16 +4,6 @@ {% load form_tags %} {% block content %} - {% block actions %} - {% if actions %} - - {% endif %} - {% endblock %} - {% block filter_form %} {% if filter_form %}
diff --git a/gas/views.py b/gas/views.py index 3108592..837e948 100644 --- a/gas/views.py +++ b/gas/views.py @@ -44,6 +44,7 @@ class GASMixin: help_text = '' success_message = _("Operation successful.") breadcrumbs = [] + actions = None def dispatch(self, *args, **kwargs): user = self.request.user @@ -93,6 +94,9 @@ class GASMixin: " Returns a list of (url, label) tuples for the breadcrumbs " return self.breadcrumbs + def get_actions(self): + return self.actions or [] + def get_context_data(self, **kwargs): ctx = super().get_context_data(**kwargs) ctx.update({ @@ -101,6 +105,7 @@ class GASMixin: 'title': self.get_title(), 'help_text': self.get_help_text(), 'breadcrumbs': self.get_breadcrumbs(), + 'actions': self.get_actions(), 'gas_title': gas_settings.TITLE, 'logo_static_url': gas_settings.LOGO, 'css': gas_settings.MEDIA['css'], @@ -112,7 +117,6 @@ class GASMixin: class GASListView(GASMixin, ListView): """ ListView, permite indicar un formulario para filtrar contenido. """ filter_form_class = None - actions = None def get_filter_form(self): if self.filter_form_class is None: @@ -131,14 +135,10 @@ class GASListView(GASMixin, ListView): qs = super().get_queryset() return self.filter_queryset(qs) - def get_actions(self): - return self.actions or [] - def get_context_data(self, **kwargs): ctx = super().get_context_data(**kwargs) ctx.update({ 'filter_form': self.filter_form, - 'actions': self.get_actions(), }) return ctx