def field_value(revision, field): value = getattr(revision, field) if field in ['is_current', 'is_surrogate', 'no_volume', 'display_volume_with_number', 'no_brand', 'page_count_uncertain', 'title_inferred']: return yesno(value, 'Yes,No') elif field in ['publisher', 'indicia_publisher', 'brand']: return absolute_url(value) elif field in ['notes', 'tracking_notes', 'publication_notes', 'characters', 'synopsis', 'reprint_notes']: return linebreaksbr(value) elif field in ['url']: return urlize(value) elif field in ['indicia_pub_not_printed']: return yesno(value, 'Not Printed,Printed') elif field in ['no_editing', 'no_script', 'no_pencils', 'no_inks', 'no_colors', 'no_letters']: return yesno(value, 'X, ') elif field in ['page_count']: if revision.source_name == 'issue' and revision.changeset.storyrevisions.count(): # only calculate total sum for issue not sequences sum_story_pages = format_page_count(sum_page_counts( revision.changeset.storyrevisions.all())) return u'%s (total sum of story page counts: %s' % \ (format_page_count(value), sum_story_pages) return format_page_count(value) return value
def field_value(revision, field): value = getattr(revision, field) if field in [ 'is_current', 'is_surrogate', 'no_volume', 'display_volume_with_number', 'no_brand', 'page_count_uncertain', 'title_inferred' ]: return yesno(value, 'Yes,No') elif field in ['publisher', 'indicia_publisher', 'brand']: return absolute_url(value) elif field in [ 'notes', 'tracking_notes', 'publication_notes', 'characters', 'synopsis', 'reprint_notes' ]: return linebreaksbr(value) elif field in ['url']: return urlize(value) elif field in ['indicia_pub_not_printed']: return yesno(value, 'Not Printed,Printed') elif field in [ 'no_editing', 'no_script', 'no_pencils', 'no_inks', 'no_colors', 'no_letters' ]: return yesno(value, 'X, ') elif field in ['page_count']: if revision.source_name == 'issue' and revision.changeset.storyrevisions.count( ): # only calculate total sum for issue not sequences sum_story_pages = format_page_count( sum_page_counts(revision.changeset.storyrevisions.all())) return u'%s (total sum of story page counts: %s' % \ (format_page_count(value), sum_story_pages) return format_page_count(value) return value
def field_value(revision, field): value = getattr(revision, field) if field in [ 'is_surrogate', 'no_volume', 'display_volume_with_number', 'no_brand', 'page_count_uncertain', 'title_inferred' ]: return yesno(value, 'Yes,No') elif field in ['is_current']: res_holder_display = '' if revision.previous(): reservation = revision.source.get_ongoing_reservation() if revision.previous().is_current and not value and reservation: res_holder = reservation.indexer res_holder_display = ' (ongoing reservation held by %s %s)' % \ (res_holder.first_name, res_holder.last_name) return yesno(value, 'Yes,No') + res_holder_display elif field in ['publisher', 'indicia_publisher', 'brand']: return absolute_url(value) elif field in [ 'notes', 'tracking_notes', 'publication_notes', 'characters', 'synopsis', 'reprint_notes' ]: return linebreaksbr(value) elif field in ['url']: return urlize(value) elif field in ['indicia_pub_not_printed']: return yesno(value, 'Not Printed,Printed') elif field in [ 'no_editing', 'no_script', 'no_pencils', 'no_inks', 'no_colors', 'no_letters' ]: return yesno(value, 'X, ') elif field in ['page_count']: if revision.source_name == 'issue' and \ revision.changeset.storyrevisions.count(): # only calculate total sum for issue not sequences sum_story_pages = format_page_count( sum_page_counts(revision.changeset.storyrevisions.all())) return u'%s (note: total sum of story page counts is %s)' % \ (format_page_count(value), sum_story_pages) return format_page_count(value) elif field == 'isbn': if value: if validated_isbn(value): return u'%s (note: valid ISBN)' % value elif len(value.split(';')) > 1: return u'%s (note: invalid or inequal ISBNs)' % value elif value: return u'%s (note: invalid ISBN)' % value return value
def field_value(revision, field): value = getattr(revision, field) if field in ['is_surrogate', 'no_volume', 'display_volume_with_number', 'no_brand', 'page_count_uncertain', 'title_inferred']: return yesno(value, 'Yes,No') elif field in ['is_current']: res_holder_display = '' if revision.previous(): reservation = revision.source.get_ongoing_reservation() if revision.previous().is_current and not value and reservation: res_holder = reservation.indexer res_holder_display = ' (ongoing reservation held by %s %s)' % \ (res_holder.first_name, res_holder.last_name) return yesno(value, 'Yes,No') + res_holder_display elif field in ['publisher', 'indicia_publisher', 'brand']: return absolute_url(value) elif field in ['notes', 'tracking_notes', 'publication_notes', 'characters', 'synopsis', 'reprint_notes']: return linebreaksbr(value) elif field in ['url']: return urlize(value) elif field in ['indicia_pub_not_printed']: return yesno(value, 'Not Printed,Printed') elif field in ['no_editing', 'no_script', 'no_pencils', 'no_inks', 'no_colors', 'no_letters']: return yesno(value, 'X, ') elif field in ['page_count']: if revision.source_name == 'issue' and \ revision.changeset.storyrevisions.count(): # only calculate total sum for issue not sequences sum_story_pages = format_page_count(sum_page_counts( revision.changeset.storyrevisions.all())) return u'%s (note: total sum of story page counts is %s)' % \ (format_page_count(value), sum_story_pages) return format_page_count(value) elif field == 'isbn': if value: if validated_isbn(value): return u'%s (note: valid ISBN)' % value elif len(value.split(';')) > 1: return u'%s (note: invalid or inequal ISBNs)' % value elif value: return u'%s (note: invalid ISBN)' % value return value