make it easier to find and edit ebook editions

pull/1/head
eric 2016-08-16 17:17:24 -04:00
parent 363c86fd94
commit 221efdec6c
2 changed files with 8 additions and 1 deletions

View File

@ -242,7 +242,11 @@ class EditionForm(forms.ModelForm):
has_goog = self.cleaned_data.get("goog", False) not in nulls
has_http = self.cleaned_data.get("http", False) not in nulls
has_doi = self.cleaned_data.get("doi", False) not in nulls
if not has_isbn and not has_oclc and not has_goog and not has_http and not has_doi:
try:
has_id = self.instance.work.identifiers.all().count() > 0
except AttributeError:
has_id = False
if not has_id and not has_isbn and not has_oclc and not has_goog and not has_http and not has_doi:
raise forms.ValidationError(_("There must be either an ISBN, a DOI, a URL or an OCLC number."))
return self.cleaned_data
class Meta:

View File

@ -19,6 +19,9 @@
{% if edition.note %}
{{ edition.note }}.<br />
{% endif %}
{% if edition.ebooks.all %}
{{ edition.ebooks.all.count }} ebooks<br />
{% endif %}
{% if edition.publisher %}
Publisher: <a href="{% url 'bypubname_list' edition.publisher_name.id %}">{{edition.publisher}}</a><br />
{% endif %}