# Path: mtlmurals/modules/mural/models.py
# class Mural(models.Model, Timestamp):
#     """ Represents a mural. """
# 
#     __tablename__ = 'mural'
#     id = db.Column(db.Integer, primary_key=True)
# 
#     # The import ID is the identifier associated with each mural that is embedded inside exports of
#     # the murals set provided by the Montréal open data website.
#     import_id = db.Column(db.String(length=64), unique=True, index=True)
# 
#     # A mural can be associated with many artists. It can (potentially) be realized by an
#     # organization which was financed to create murals. Fundings can come from a specific program.
#     artists = db.relationship(
#         'Artist', secondary=mural_artists, backref=db.backref('murals', lazy='dynamic'))
#     organization_id = db.Column(db.Integer, db.ForeignKey('organization.id'), nullable=True)
#     program_id = db.Column(db.Integer, db.ForeignKey('program.id'), nullable=True)
# 
#     # The mural itself!
#     image = db.Column(db.Unicode(length=255), nullable=True)
# 
#     # The year when the mural was created is stored in this field.
#     year = db.Column(db.SmallInteger)
# 
#     # These fields define the address of a mural.
#     address = db.Column(db.Unicode(length=124))
#     address_2 = db.Column(db.Unicode(length=124), nullable=True)
#     zip_code = db.Column(db.String(length=20), nullable=True, index=True)
#     city = db.Column(db.Unicode(length=124), index=True)
#     country = db.Column(db.Unicode(length=124), index=True)
# 
#     # The fields define the coordinates of a mural.
#     latitude = db.Column(db.Numeric, index=True)
#     longitude = db.Column(db.Numeric, index=True)


from flask import Blueprint
from flask import render_template
from .models import Mural
"""
    Mural views
    ===========

    This module defines views that will be used to browse murals.

"""




mural_blueprint = Blueprint('mural', __name__, url_prefix='/')


@mural_blueprint.route('/', methods=['GET', ])
def entrypoint():
    """ The main entrypoint of our murals search engine. """

# Path: mtlmurals/modules/mural/models.py
# class Mural(models.Model, Timestamp):
#     """ Represents a mural. """
# 
#     __tablename__ = 'mural'
#     id = db.Column(db.Integer, primary_key=True)
# 
#     # The import ID is the identifier associated with each mural that is embedded inside exports of
#     # the murals set provided by the Montréal open data website.
#     import_id = db.Column(db.String(length=64), unique=True, index=True)
# 
#     # A mural can be associated with many artists. It can (potentially) be realized by an
#     # organization which was financed to create murals. Fundings can come from a specific program.
#     artists = db.relationship(
#         'Artist', secondary=mural_artists, backref=db.backref('murals', lazy='dynamic'))
#     organization_id = db.Column(db.Integer, db.ForeignKey('organization.id'), nullable=True)
#     program_id = db.Column(db.Integer, db.ForeignKey('program.id'), nullable=True)
# 
#     # The mural itself!
#     image = db.Column(db.Unicode(length=255), nullable=True)
# 
#     # The year when the mural was created is stored in this field.
#     year = db.Column(db.SmallInteger)
# 
#     # These fields define the address of a mural.
#     address = db.Column(db.Unicode(length=124))
#     address_2 = db.Column(db.Unicode(length=124), nullable=True)
#     zip_code = db.Column(db.String(length=20), nullable=True, index=True)
#     city = db.Column(db.Unicode(length=124), index=True)
#     country = db.Column(db.Unicode(length=124), index=True)
# 
#     # The fields define the coordinates of a mural.
#     latitude = db.Column(db.Numeric, index=True)
#     longitude = db.Column(db.Numeric, index=True)


# Path: mtlmurals/modules/mural/views.py
from flask import Blueprint
from flask import render_template
from .models import Mural

"""
    Mural views
    ===========

    This module defines views that will be used to browse murals.

"""




mural_blueprint = Blueprint('mural', __name__, url_prefix='/')


@mural_blueprint.route('/', methods=['GET', ])
def entrypoint():
    """ The main entrypoint of our murals search engine. """

    years = next(zip(*Mural.query.order_by(Mural.year).distinct().values(Mural.year)), [])