fmartingr
/
shelfzilla
Archived
1
0
Fork 0

- Improved publisher series list layout to "match" volumes list

- Added actions to mark/unmark for review in the admin
- Updated language es_ES
This commit is contained in:
Felipe Martin 2014-04-25 17:18:37 +02:00
parent 67c60c8784
commit 4e9205e5cb
4 changed files with 64 additions and 61 deletions

View File

@ -1,15 +1,28 @@
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import ContentType
from django.http import HttpResponseRedirect
from django.contrib import messages
import reversion
from .models import Publisher, Series, Volume, Person
# Actions
def mark_for_review(self, request, queryset):
queryset.update(for_review=True)
messages.success(request, _('Items marked for review'))
def unmark_for_review(self, request, queryset):
queryset.update(for_review=False)
messages.success(request, _('Items unmarked for review'))
# Modeladmin
class PublisherAdmin(reversion.VersionAdmin):
list_display = ['name', 'series_count']
prepopulated_fields = {"slug": ("name",)}
actions = (mark_for_review, unmark_for_review, )
def series_count(self, obj):
return obj.series.count()
@ -23,6 +36,7 @@ class SeriesAdmin(reversion.VersionAdmin):
prepopulated_fields = {"slug": ("name",)}
search_fields = ('name', )
search_filters = ('hidden', )
actions = (mark_for_review, unmark_for_review, )
def volumes_count(self, obj):
return obj.volumes.count()
@ -37,7 +51,7 @@ class VolumeAdmin(reversion.VersionAdmin):
search_fields = ('number', 'series__name', )
list_filter = ('series', 'for_review', )
# list_editable = ('series', )
actions = ['change_series']
actions = ('change_series', mark_for_review, unmark_for_review, )
def change_series(self, request, queryset):
selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)

View File

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-25 16:52+0200\n"
"PO-Revision-Date: 2014-04-25 16:54+0200\n"
"POT-Creation-Date: 2014-04-25 17:15+0200\n"
"PO-Revision-Date: 2014-04-25 17:15+0200\n"
"Last-Translator: <fmartingr@me.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
@ -43,20 +43,27 @@ msgstr "Configuración del sitio"
msgid "Social Configuration"
msgstr "Configuración social"
#: apps/manga/admin.py:16 apps/manga/models.py:104 apps/manga/models.py:105
#: apps/manga/admin.py:14
msgid "Items marked for review"
msgstr "Marcar items para revisión"
#: apps/manga/admin.py:18
msgid "Items unmarked for review"
msgstr "Desmarcar items para revisión"
#: apps/manga/admin.py:29 apps/manga/models.py:104 apps/manga/models.py:105
#: themes/bootflat/templates/_layout.html:31
#: themes/bootflat/templates/manga/publishers/detail.html:13
#: themes/bootflat/templates/manga/publishers/detail.html:18
#: themes/bootflat/templates/manga/series/list.html:4
msgid "Series"
msgstr "Series"
#: apps/manga/admin.py:29 apps/manga/models.py:131
#: themes/bootflat/templates/manga/publishers/detail.html:16
#: themes/bootflat/templates/manga/publishers/detail.html:36
#: apps/manga/admin.py:43 apps/manga/models.py:131
#: themes/bootflat/templates/manga/publishers/detail.html:21
msgid "Volumes"
msgstr "Volúmenes"
#: apps/manga/admin.py:50
#: apps/manga/admin.py:64
#: themes/bootflat/templates/_admin/volumes/change_series.html:4
#: themes/bootflat/templates/_admin/volumes/change_series.html:8
msgid "Change volume series"
@ -64,7 +71,6 @@ msgstr "Cambiar serie de los volúmenes"
#: apps/manga/models.py:13 apps/manga/models.py:50 apps/manga/models.py:110
#: apps/manga/models.py:135
#: themes/bootflat/templates/manga/publishers/detail.html:35
msgid "Name"
msgstr "Nombre"
@ -91,7 +97,6 @@ msgid "Summary"
msgstr "Resumen"
#: apps/manga/models.py:54
#: themes/bootflat/templates/manga/publishers/detail.html:37
#: themes/bootflat/templates/manga/series/detail.html:25
msgid "Finished"
msgstr "Finalizado"
@ -238,19 +243,17 @@ msgstr "Cambiar a:"
msgid "Change"
msgstr "Cambiar"
#: themes/bootflat/templates/manga/publishers/detail.html:20
msgid "Homepage"
msgstr "Página principal"
#: themes/bootflat/templates/manga/publishers/detail.html:54
msgid "Original series"
msgstr "Series originales"
#: themes/bootflat/templates/manga/publishers/detail.html:14
#: themes/bootflat/templates/manga/publishers/detail.html:43
#: themes/bootflat/templates/manga/series/detail.html:19
#: themes/bootflat/templates/manga/series/includes/volume.html:25
msgid "Requires review"
msgstr "Requiere revisión"
#: themes/bootflat/templates/manga/publishers/detail.html:25
msgid "Homepage"
msgstr "Página principal"
#: themes/bootflat/templates/manga/series/detail.html:23
msgid "Status"
msgstr "Estado"
@ -298,3 +301,6 @@ msgstr "Lista de deseados"
#: themes/bootflat/templates/users/profile/achievements.html:4
msgid "Achievements"
msgstr "Logros"
#~ msgid "Original series"
#~ msgstr "Series originales"

View File

@ -1,5 +1,5 @@
{% extends '_layout.html'|pjax:request %}
{% load i18n %}
{% load i18n thumbnail %}
{% block page_title %}{{ block.super }} | {{ item.name }}{% endblock %}
@ -9,6 +9,11 @@
<div class="col-md-3">
<div class="panel panel-primary">
<ul class="list-group">
{% if item.for_review and user.is_staff %}
<a class="list-group-item list-group-item-warning text-center">
{% trans "Requires review" %}
</a>
{% endif %}
<li class="list-group-item">
<strong>{% trans "Series" %}</strong>: {{ item.series.count }}
</li>
@ -29,46 +34,24 @@
<h1 class="panel-title panel-title-alt text-center">{{ item.name }}</h1>
</div>
</div>
<div class="series-list panel">
<table class="table table-bordered">
<thead>
<th>{% trans "Name" %}</th>
<th>{% trans "Volumes" %}</th>
<th>{% trans "Finished" %}</th>
</thead>
<tbody>
{% for series in item.series %}
<tr>
<td>
{% if series.slug %}
<a href="{% url 'series.detail' series.pk series.slug %}" data-pjax>{{ series.name }}</a>
{% else %}
<a href="{% url 'series.detail' series.pk %}" data-pjax>{{ series.name }}</a>
{% endif %}
</td>
<td>{{ series.volumes.count }}</td>
<td>{{ series.finished|yesno|capfirst }}</td>
</tr>
{% endfor %}
<tr>
<td colspan="4"><strong>{% trans "Original series" %}</strong></td>
</tr>
{% for series in item.original_series.all %}
<tr>
<td>
{% if series.slug %}
<a href="{% url 'series.detail' series.pk series.slug %}" data-pjax>{{ series.name }}</a>
{% else %}
<a href="{% url 'series.detail' series.pk %}" data-pjax>{{ series.name }}</a>
{% endif %}
</td>
<td>{{ series.volumes.count }}</td>
<td>{{ series.finished|yesno|capfirst }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="series-list">
<div class="row">
{% for series in item.series %}
<div class="col-sm-3">
<div class="well text-center">
{% if series.for_review and user.is_staff %}
<span class="label label-warning">{% trans "Requires review" %}</span>
{% endif %}
<h4><a href="{% url 'series.detail' series.pk series.slug %}">{{ series.name }}</a></h4>
<img class="volume-cover" src="{% thumbnail series.last_volume_cover 200x200 %}" />
</div>
</div>
{% if forloop.counter|divisibleby:4 %}
</div>
<div class="row">
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>