title: Routes filtering by Language and/or category
body: <p>I'm building a StumbleUpon like application which the content has to be filtered by language and category. I have two simple routes for each, language and category, but I would like to know if it's possible to have both in one simple router declaration. To not get confused I'm using Peewee as the ORM.</p>
  
  <p>Here are the routes I've already defined:</p>
  
  <pre><code>@app.route("/&lt;language&gt;")
  def languages(language):
      links = []
  
      for contenido in models.Post.select().where(models.Post.language**language):
          links.append(contenido.content)
  
      iframe = random.choice(links)
      return render_template('language.html', iframe=iframe, language=language)
  
  
  @app.route("/&lt;category&gt;")
  def categories(category):
      links = []
  
      for contenido in models.Post.select().where(models.Post.category**category):
          links.append(contenido.content)
  
      iframe = random.choice(links)
      return render_template('category.html', iframe=iframe, category=category)
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>class Post(Model):
      timestamp = DateTimeField(default=datetime.datetime.now)
      user = ForeignKeyField(
          rel_model=User,
          related_name='posts'
      )
      language = TextField()
      category = TextField()
      content = TextField()
  
      class Meta:
          database = DATABASE
  </code></pre>
  
  <p>What I'm trying to do is to have a relation on language and/or categories in the navigation feature. Is it possible to create something like this? I'm actually really lost trying to accomplish something like this. At the time I have something that could look a little what I'm trying to do, here is the snippet:</p>
  
  <pre><code>@app.route("/&lt;language&gt;/&lt;category&gt;")
  def mixin(language, category):
      language_links = []
      category_links = []
  
      for contenido in models.Post.select().where(models.Post.language**language):
          language_links.append(contenido.content)
  
      for contenido in models.Post.select().where(models.Post.category**category):
          category_links.append(contenido.content)
  
  
      if category_links == []:
          iframe = random.choice(language_links)
      else:
          iframe = random.choice(category_links)
  
      return render_template('language.html', iframe=iframe, language=language, category=category)
  </code></pre>