old_contents: from flask import abort, Blueprint, flash, redirect, render_template, url_for
  from flask_babel import gettext
  from teknologkoren_se import app, images
  from teknologkoren_se.models import Post, Event
  from teknologkoren_se.util import url_for_other_page, bp_url_processors
  
  
  mod = Blueprint('blog', __name__, url_prefix='/<any(sv, en):lang_code>')
  
  bp_url_processors(mod)
  
  
  def is_event(post):
      """Check whether an object is of Event type.
  
      Used by templates as posts and events are in the same list.
      """
      if isinstance(post, Event):
          return True
      return False
  
  
  def image_destination():
      return images.config.base_url
  
  
  app.jinja_env.globals['url_for_other_page'] = url_for_other_page
  app.jinja_env.globals['image_url'] = images.url
  app.jinja_env.globals['image_dest'] = image_destination
  app.jinja_env.tests['event'] = is_event
  
  
  @mod.route('/', defaults={'page': 1})
  @mod.route('/page/<int:page>/')
  def index(page):
      """Show blogposts and events, main page.
  
      Event is a subclass of Post, querying Post returns both events and
      posts.
      """
      posts = (Post.query.filter_by(published=True)
               .order_by(Post.timestamp.desc()))
  
      pagination = posts.paginate(page, 5)
  
      return render_template('blog/overview.html',
                             pagination=pagination,
                             page=page)
  
  
  @mod.route('/blog/<int:post_id>/')
  @mod.route('/blog/<int:post_id>/<slug>/')
  def view_post(post_id, slug=None):
      """View a single blogpost."""
      post = Post.query.get_or_404(post_id)
  
      if not post.published:
          return abort(404)
  
      # Redirect to url with correct slug if missing or incorrect
      if slug != post.slug:
          return redirect(url_for('.view_post', post_id=post.id, slug=post.slug))
  
      return render_template('blog/view-post.html', post=post)
  
new_contents: from flask import abort, Blueprint, flash, redirect, render_template, url_for
  from flask_babel import gettext, get_locale
  from teknologkoren_se import app, images
  from teknologkoren_se.models import Post, Event
  from teknologkoren_se.util import url_for_other_page, bp_url_processors
  
  
  mod = Blueprint('blog', __name__, url_prefix='/<any(sv, en):lang_code>')
  
  bp_url_processors(mod)
  
  
  def is_event(post):
      """Check whether an object is of Event type.
  
      Used by templates as posts and events are in the same list.
      """
      if isinstance(post, Event):
          return True
      return False
  
  
  def image_destination():
      return images.config.base_url
  
  
  app.jinja_env.globals['url_for_other_page'] = url_for_other_page
  app.jinja_env.globals['image_url'] = images.url
  app.jinja_env.globals['image_dest'] = image_destination
  app.jinja_env.tests['event'] = is_event
  
  
  @mod.route('/', defaults={'page': 1})
  @mod.route('/page/<int:page>/')
  def index(page):
      """Show blogposts and events, main page.
  
      Event is a subclass of Post, querying Post returns both events and
      posts.
      """
      posts = (Post.query.filter_by(published=True)
               .order_by(Post.timestamp.desc()))
  
      pagination = posts.paginate(page, 5)
  
      if 'en' in get_locale().language:
          flash('We are looking for new singers! <a href="https://www.teknologkoren.se/en/blog/27/kongl-teknologkoren-soker-sangare/">More info here!</a>', 'success')
      else:
          flash('Vi söker nya sångare! <a href="https://www.teknologkoren.se/sv/blog/27/kongl-teknologkoren-soker-sangare/">Mer info här!</a>', 'success')
  
      return render_template('blog/overview.html',
                             pagination=pagination,
                             page=page)
  
  
  @mod.route('/blog/<int:post_id>/')
  @mod.route('/blog/<int:post_id>/<slug>/')
  def view_post(post_id, slug=None):
      """View a single blogpost."""
      post = Post.query.get_or_404(post_id)
  
      if not post.published:
          return abort(404)
  
      # Redirect to url with correct slug if missing or incorrect
      if slug != post.slug:
          return redirect(url_for('.view_post', post_id=post.id, slug=post.slug))
  
      return render_template('blog/view-post.html', post=post)
  
subject: Add audition flash