1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-24 17:02:25 +00:00

Fix some front bug

This commit is contained in:
Alexandre Iooss 2019-08-11 10:49:04 +02:00
parent 861279d30d
commit 79cd008260
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
6 changed files with 55 additions and 16 deletions

View File

@ -18,9 +18,10 @@ class AuteurAdmin(VersionAdmin):
class MediaAdmin(VersionAdmin):
list_display = ('title', 'authors_list', 'side_title', 'isbn',
list_display = ('title', 'authors_list', 'side_identifier', 'isbn',
'external_link')
search_fields = ('title', 'authors__nom', 'side_title', 'subtitle', 'isbn')
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle',
'isbn')
autocomplete_fields = ('authors',)
date_hierarchy = 'publish_date'
form = MediaAdminForm
@ -31,8 +32,11 @@ class MediaAdmin(VersionAdmin):
authors_list.short_description = _('authors')
def external_link(self, obj):
return format_html('<a href="{}" target="about:blank">{}</a>',
obj.external_url, obj.external_url)
if obj.external_url:
return format_html('<a href="{}" target="about:blank">{}</a>',
obj.external_url, obj.external_url)
else:
return "-"
external_link.allow_tags = True
external_link.short_description = _('external url')
@ -59,8 +63,8 @@ class MediaAdmin(VersionAdmin):
class EmpruntAdmin(VersionAdmin):
list_display = ('media', 'user', 'date_emprunt', 'date_rendu',
'permanencier_emprunt', 'permanencier_rendu_custom')
search_fields = ('media__title', 'media__side_title', 'user__username',
'date_emprunt', 'date_rendu')
search_fields = ('media__title', 'media__side_identifier',
'user__username', 'date_emprunt', 'date_rendu')
date_hierarchy = 'date_emprunt'
autocomplete_fields = ('media', 'user', 'permanencier_emprunt',
'permanencier_rendu')

View File

@ -33,10 +33,9 @@ class MediaAdminForm(ModelForm):
data = data['ISBN:' + isbn]
# Fill the data
# TODO implement authors
# TODO implement authors, side_identifier
if data['title']:
self.cleaned_data['title'] = data['title']
self.cleaned_data['side_title'] = data['title']
if data['subtitle']:
self.cleaned_data['subtitle'] = data['subtitle']
if data['url']:

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-11 10:39+0200\n"
"POT-Creation-Date: 2019-08-11 10:46+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -13,19 +13,19 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: admin.py:31 models.py:20 models.py:51
#: admin.py:32 models.py:20 models.py:51
msgid "authors"
msgstr "auteurs"
#: admin.py:38
#: admin.py:39
msgid "external url"
msgstr "URL externe"
#: admin.py:78
#: admin.py:79
msgid "Turn back"
msgstr "Rendre"
#: admin.py:81
#: admin.py:82
msgid "permanencier rendu"
msgstr ""
@ -58,7 +58,7 @@ msgid "external URL"
msgstr "URL externe"
#: models.py:46
msgid "side title"
msgid "side identifier"
msgstr "côte"
#: models.py:54

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2019-08-11 08:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('media', '0019_auto_20190811_0919'),
]
operations = [
migrations.RenameField(
model_name='media',
old_name='side_title',
new_name='side_identifier',
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2019-08-11 08:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('media', '0020_auto_20190811_1047'),
]
operations = [
migrations.AlterField(
model_name='media',
name='side_identifier',
field=models.CharField(max_length=255, verbose_name='side identifier'),
),
]

View File

@ -42,8 +42,8 @@ class Media(models.Model):
blank=True,
null=True,
)
side_title = models.CharField(
verbose_name=_('side title'),
side_identifier = models.CharField(
verbose_name=_('side identifier'),
max_length=255,
)
authors = models.ManyToManyField(