How to check the total views on a page-flask?

I’m building an app which allows users to look in to view my cv. I want to see how many views each page has and from which user.

I have a visit table which I’m hoping will store the pagename along with the user Id every time a page is viewed. So every record will be a new visit to that page.

Any suggestions or a better way to do this?

class  User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), index=True, unique=True)
    visits = db.relationship('Visit', backref='user', lazy='dynamic')
    password_hash = db.Column(db.String(128))

    def __repr__(self):
        return 'Username: {}'.format(self.username)

    def set_password(self, password):
        self.password_hash = generate_password_hash(password)

    def check_password(self, password):
        return check_password_hash(self.password_hash, password)

    def update_cv_looks(self):
        self.cv_looks += 1

    def page_visits(self, pagename):
        list_of_visits = self.visits.filter_by(page_name=pagename).all()
        return len(list_of_visits)

class Visit(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey(''))
    page_name = db.Column(db.String(25))

    def __repr__(self):
        return 'Page: {}'.format(self.page_name)

def cover():
    return render_template('cover.html', title='Cover Page')

def index():
    return render_template(
        'index.html', title='Home Page')


Place this in the under the Visit class.

def update_visits(self, user_id, pagename):
self.user_id, self.page_name = user_id, pagename

Place this under the index

v = Visit()
v.update_visits(, pagename='index')