mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Used filters to present results of views better for #128
This commit is contained in:
parent
611b34fd64
commit
0092325262
3 changed files with 10 additions and 15 deletions
|
|
@ -1,9 +1,9 @@
|
|||
{% extends "admin2/bootstrap/base.html" %}
|
||||
{% load admin2_tags %}
|
||||
|
||||
{% block title %}Select {{ model }} to change{% endblock %}
|
||||
{% block title %}Select {{ model|model_verbose_name }} to change{% endblock %}
|
||||
|
||||
{% block page_title %}Select {{ model }} to change{% endblock %}
|
||||
{% block page_title %}Select {{ model|model_verbose_name }} to change{% endblock %}
|
||||
|
||||
{% block extrajs %}
|
||||
<script src="/static/themes/bootstrap/js/actions.js"></script>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<span id="selected-count">0</span> of {{ object_list|length }} selected
|
||||
<div class="pull-right">
|
||||
{# if has_add_permission #}
|
||||
<a href="{% url view|admin2_urlname:'create' %}" class="btn"><i class="icon-plus"></i> Add {{ model }}</a>
|
||||
<a href="{% url view|admin2_urlname:'create' %}" class="btn"><i class="icon-plus"></i> Add {{ model|model_verbose_name }}</a>
|
||||
{# endif #}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<th><input type="checkbox" class="model-select-all"></th>
|
||||
<th>{{ model|title}}</th>
|
||||
<th>{{ model|model_verbose_name|title}}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for obj in object_list %}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
{% load admin2_tags %}
|
||||
|
||||
{% block title %}{{ action }} {{ model }}{% endblock %}
|
||||
{% block title %}{{ action }} {{ model|model_verbose_name }}{% endblock %}
|
||||
|
||||
{% block page_title %}{{ action }} {{ model }}{% endblock %}
|
||||
{% block page_title %}{{ action }} {{ model|model_verbose_name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from django.views import generic
|
|||
|
||||
import extra_views
|
||||
|
||||
from .utils import model_options
|
||||
from .viewmixins import Admin2Mixin, AdminModel2Mixin, Admin2ModelFormMixin
|
||||
|
||||
|
||||
|
|
@ -40,9 +39,7 @@ class ModelListView(Admin2Mixin, generic.ListView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ModelListView, self).get_context_data(**kwargs)
|
||||
model_meta = model_options(self.get_model())
|
||||
context['model'] = model_meta.verbose_name
|
||||
context['model_pluralized'] = model_meta.verbose_name_plural
|
||||
context['model'] = self.get_model()
|
||||
context['actions'] = self.get_actions().values()
|
||||
return context
|
||||
|
||||
|
|
@ -66,8 +63,7 @@ class ModelEditFormView(AdminModel2Mixin, Admin2ModelFormMixin, extra_views.Upda
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ModelEditFormView, self).get_context_data(**kwargs)
|
||||
model_meta = model_options(self.get_model())
|
||||
context['model'] = model_meta.verbose_name
|
||||
context['model'] = self.get_model()
|
||||
context['action'] = "Change"
|
||||
return context
|
||||
|
||||
|
|
@ -79,13 +75,12 @@ class ModelAddFormView(AdminModel2Mixin, Admin2ModelFormMixin, extra_views.Creat
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ModelAddFormView, self).get_context_data(**kwargs)
|
||||
model_meta = model_options(self.get_model())
|
||||
context['model'] = model_meta.verbose_name
|
||||
context['model'] = self.get_model()
|
||||
context['action'] = "Add"
|
||||
return context
|
||||
|
||||
|
||||
class ModelDeleteView(AdminModel2Mixin, generic.DeleteView):
|
||||
success_url = "../../"
|
||||
success_url = "../../" # TODO - fix this!
|
||||
default_template_name = "model_confirm_delete.html"
|
||||
permission_type = 'delete'
|
||||
|
|
|
|||
Loading…
Reference in a new issue