from flask import render_template
from flask_classy import FlaskView
from ..models import PostModel


class Main(FlaskView):
    """ Main page view. """

    route_base = "/"

    def index(self):
        posts = PostModel.fetch()
        return render_template("index.html", posts=posts)

from flask import render_template
from flask_classy import FlaskView
from ..models import PostModel


class Main(FlaskView):
    """ Main page view. """

    route_base = "/"

    def index(self):
        PostModel.set_query()
        PostModel.query.order = ['-updated', 'title']
        posts = PostModel.fetch()
        return render_template("index.html", posts=posts)

Set index main view to return post ordered by updated and title field
Set index main view to return post ordered by updated and title field

  from flask import render_template
  from flask_classy import FlaskView
  from ..models import PostModel
  
  
  class Main(FlaskView):
      """ Main page view. """
  
      route_base = "/"
  
      def index(self):
+         PostModel.set_query()
+         PostModel.query.order = ['-updated', 'title']
          posts = PostModel.fetch()
          return render_template("index.html", posts=posts)
  
Set index main view to return post ordered by updated and title field
## Code Before:
from flask import render_template
from flask_classy import FlaskView
from ..models import PostModel


class Main(FlaskView):
    """ Main page view. """

    route_base = "/"

    def index(self):
        posts = PostModel.fetch()
        return render_template("index.html", posts=posts)

## Instruction:
Set index main view to return post ordered by updated and title field
## Code After:
from flask import render_template
from flask_classy import FlaskView
from ..models import PostModel


class Main(FlaskView):
    """ Main page view. """

    route_base = "/"

    def index(self):
        PostModel.set_query()
        PostModel.query.order = ['-updated', 'title']
        posts = PostModel.fetch()
        return render_template("index.html", posts=posts)
