def show(self, id, list_all=0): try: a = Artist.get(id) except SQLObjectNotFound: flash("Artist ID not found") util.redirect("/artists/list") except ValueError: try: a = Artist.byNameI(urllib.unquote_plus(id)) except SQLObjectNotFound: flash("Artist ID not found") util.redirect("/artists/list") if identity.current.user and a in identity.current.user.artists: is_tracked = True else: is_tracked = False past_events = a.events.filter(Event.q.date < date.today()).orderBy('-date') if not list_all: past_events = past_events[:5] future_events = a.events.filter(Event.q.date >= date.today()).orderBy('date') return dict(artist=a, past_events=past_events, future_events=future_events, tracked_count=a.users.count(), is_tracked=is_tracked, description=util.desc_format(a.description), artist_list=artist_list)
def show(self, user_name): try: u = UserAcct.by_user_name(user_name) artists = u.artists.orderBy(Artist.q.name) venues = u.venues.orderBy(Venue.q.name) attendances = Attendance.selectBy(user=u) viewing_self = False if identity.current.user and identity.current.user.user_name == user_name: viewing_self = True except SQLObjectNotFound: flash("User not found") util.redirect("/") return dict(user=u, artists=artists, venues=venues, attendances=attendances, viewing_self=viewing_self, description=util.desc_format(u.description))
def show(self, id, list_all=0): try: v = Venue.get(id) except SQLObjectNotFound: flash("Venue ID not found") util.redirect("/venues/list") except ValueError: try: v = Venue.byNameI(urllib.unquote_plus(id)) except SQLObjectNotFound: flash("Venue ID not found") util.redirect("/venues/list") is_tracked = identity.current.user and v in identity.current.user.venues past_events = v.past_events.orderBy('-date') if not list_all: past_events = past_events[:5] future_events = v.future_events.orderBy('date') return dict(venue=v, past_events=past_events, future_events=future_events, description=util.desc_format(v.description), googlemap=googlemap, tracked_count=v.users.count(), is_tracked=is_tracked)