Better roman import
This commit is contained in:
parent
3edc3ffa02
commit
8c8692b8d2
|
@ -135,6 +135,8 @@ class MediaAdminForm(ModelForm):
|
||||||
self.cleaned_data['number_of_pages'] = 0
|
self.cleaned_data['number_of_pages'] = 0
|
||||||
|
|
||||||
if 'publishedDate' in info:
|
if 'publishedDate' in info:
|
||||||
|
if "-" not in info["publishedDate"]:
|
||||||
|
info["publishedDate"] += "-01-01"
|
||||||
self.cleaned_data['publish_date'] = info['publishedDate']
|
self.cleaned_data['publish_date'] = info['publishedDate']
|
||||||
|
|
||||||
if 'authors' not in self.cleaned_data \
|
if 'authors' not in self.cleaned_data \
|
||||||
|
|
|
@ -24,9 +24,9 @@ class Command(BaseCommand):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if cl.objects.filter(isbn=isbn).exists():
|
if cl.objects.filter(isbn=isbn).exists():
|
||||||
self.stderr.write(self.style.WARNING(
|
self.stderr.write(self.style.WARNING(f"ISBN {isbn} for type {type_str} already exists, remove it"))
|
||||||
"ISBN {isbn} already exists".format(isbn=isbn)
|
future_medium.delete()
|
||||||
))
|
continue
|
||||||
|
|
||||||
form = MediaAdminForm(instance=cl(),
|
form = MediaAdminForm(instance=cl(),
|
||||||
data={"isbn": isbn, "_isbn": True, })
|
data={"isbn": isbn, "_isbn": True, })
|
||||||
|
@ -35,6 +35,8 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
form.full_clean()
|
form.full_clean()
|
||||||
|
if hasattr(form.instance, "subtitle") and not form.instance.subtitle:
|
||||||
|
form.instance.subtitle = ""
|
||||||
form.save()
|
form.save()
|
||||||
future_medium.delete()
|
future_medium.delete()
|
||||||
self.stdout.write(self.style.SUCCESS(
|
self.stdout.write(self.style.SUCCESS(
|
||||||
|
|
Loading…
Reference in New Issue