def link_other_reprint(reprint, is_source): if is_source: if hasattr(reprint, 'target'): text = '<a href="%s">%s</a> <br> of %s' % \ (reprint.target.get_absolute_url(), show_story_short(reprint.target), reprint.target.issue.full_name()) else: text = '<a href="%s">%s</a>' % \ (reprint.target_issue.get_absolute_url(), reprint.target_issue.full_name()) else: if hasattr(reprint, 'origin'): text = '<a href="%s">%s</a> <br> of %s' % \ (reprint.origin.get_absolute_url(), show_story_short(reprint.origin), reprint.origin.issue.full_name()) else: text = '<a href="%s">%s</a>' % \ (reprint.origin_issue.get_absolute_url(), reprint.origin_issue.full_name()) return mark_safe(text)
class SelectCacheForm(forms.Form): fields = [] if cached_issue: fields.append( ('issue_%d' % cached_issue.id, 'issue: %s' % cached_issue)) if cached_story: fields.append( ('story_%d' % cached_story.id, mark_safe('story: %s in %s' % (show_story_short(cached_story), esc(cached_story.issue))))) if cached_cover: fields.append(('cover_%d' % cached_cover.id, 'cover of issue: %s' % cached_cover.issue)) if fields: object_choice = forms.ChoiceField(widget=RadioSelect, choices=fields, label='')
def generate_reprint_notes(from_reprints=[], to_reprints=[], original='', level=0, no_promo=False): reprint = "" last_series = None last_follow = None same_issue_cnt = 0 for from_reprint in from_reprints: if hasattr(from_reprint, 'origin_issue') and from_reprint.origin_issue: follow_info = '' if last_series == from_reprint.origin_issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link(from_reprint.origin_issue, "from ", notes=from_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow != None: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = from_reprint.origin_issue.series reprint += generate_reprint_link(from_reprint.origin_issue, "from ", notes=from_reprint.notes) if original == 'With_Story': reprint += '<br>points to issue' last_follow = follow_info else: follow_info = follow_reprint_link(from_reprint, 'from', level=level+1) if last_series == from_reprint.origin.issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link_sequence(from_reprint.origin, "from ", notes=from_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = from_reprint.origin.issue.series reprint += generate_reprint_link_sequence(from_reprint.origin, "from ", notes=from_reprint.notes) if original == 'With_Story': from apps.gcd.templatetags.display import show_story_short reprint += '<br>points to sequence: %s' % \ show_story_short(from_reprint.origin) last_follow = follow_info if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow last_series = None last_follow = None same_issue_cnt = 0 for to_reprint in to_reprints: if hasattr(to_reprint, 'target_issue') and to_reprint.target_issue: follow_info = '' if last_series == to_reprint.target_issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link(to_reprint.target_issue, "in ", notes=to_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow != None: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = to_reprint.target_issue.series reprint += generate_reprint_link(to_reprint.target_issue, "in ", notes = to_reprint.notes) if original == 'With_Story': reprint += '<br>points to issue' last_follow = follow_info else: if no_promo and to_reprint.target.type.id == STORY_TYPES['promo']: pass else: follow_info = follow_reprint_link(to_reprint, 'in', level=level+1) if last_series == to_reprint.target.issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link_sequence(to_reprint.target, "in ", notes=to_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = to_reprint.target.issue.series reprint += generate_reprint_link_sequence(to_reprint.target, "in ", notes=to_reprint.notes) if original == 'With_Story': from apps.gcd.templatetags.display import show_story_short reprint += '<br>points to sequence: %s' % \ show_story_short(to_reprint.origin) last_follow = follow_info if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow return reprint
def __str__(self): from apps.gcd.templatetags.display import show_story_short return show_story_short(self, no_number=True, markup=False)
def show_revision_short(revision, markup=True): if revision is None: return u'' if isinstance(revision, StoryRevision): return show_story_short(revision, markup=markup) return unicode(revision)
def generate_reprint_notes(from_reprints=[], to_reprints=[], original='', level=0, no_promo=False): reprint = "" last_series = None last_follow = None same_issue_cnt = 0 for from_reprint in from_reprints: if hasattr(from_reprint, 'origin_issue') and from_reprint.origin_issue: follow_info = '' if last_series == from_reprint.origin_issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link(from_reprint.origin_issue, "from ", notes=from_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow != None: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = from_reprint.origin_issue.series reprint += generate_reprint_link(from_reprint.origin_issue, "from ", notes=from_reprint.notes) if original == 'With_Story': reprint += '<br>points to issue' last_follow = follow_info else: follow_info = follow_reprint_link(from_reprint, 'from', level=level+1) if last_series == from_reprint.origin.issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link_sequence(from_reprint.origin, "from ", notes=from_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = from_reprint.origin.issue.series reprint += generate_reprint_link_sequence(from_reprint.origin, "from ", notes=from_reprint.notes) if original == 'With_Story': from apps.gcd.templatetags.display import show_story_short reprint += '<br>points to sequence: %s' % \ show_story_short(from_reprint.origin) last_follow = follow_info if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow last_series = None last_follow = None same_issue_cnt = 0 for to_reprint in to_reprints: if hasattr(to_reprint, 'target_issue') and to_reprint.target_issue: follow_info = '' if last_series == to_reprint.target_issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link(to_reprint.target_issue, "in ", notes=to_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow != None: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = to_reprint.target_issue.series reprint += generate_reprint_link(to_reprint.target_issue, "in ", notes = to_reprint.notes) if original == 'With_Story': reprint += '<br>points to issue' last_follow = follow_info else: if no_promo and to_reprint.target.type.id == STORY_TYPES['promo']: pass else: follow_info = follow_reprint_link(to_reprint, 'in', level=level+1) if last_series == to_reprint.target.issue.series and \ last_follow == follow_info and original != 'With_Story': reprint += generate_reprint_link_sequence(to_reprint.target, "in ", notes=to_reprint.notes, only_number=True) same_issue_cnt += 1 else: if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow same_issue_cnt = 0 last_series = to_reprint.target.issue.series reprint += generate_reprint_link_sequence(to_reprint.target, "in ", notes=to_reprint.notes) if original == 'With_Story': from apps.gcd.templatetags.display import show_story_short reprint += '<br>points to sequence: %s' % \ show_story_short(to_reprint.origin) last_follow = follow_info if last_follow: if same_issue_cnt > 0: last_follow = last_follow.replace('which is', 'which are', 1) reprint += '</li>' + last_follow return reprint
def __unicode__(self): from apps.gcd.templatetags.display import show_story_short return show_story_short(self, no_number=True, markup=False)