# -*- coding: utf-8 -*-
import json
import os
import sys

import django

sys.path.append("../server")

os.environ.setdefault("IT_APP_ENVIRONMENT", "local")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.base")
django.setup()

from wagtail.models import Page


def main():
    from django.conf import settings

    settings.DEBUG = True
    from django.db import connection
    from django.db import reset_queries

    reset_queries()

    page = Page.objects.get(
        slug="versicherungsvermittlerin", locale__language_code="de-CH"
    )
    serializer = page.specific.get_serializer_class()(page.specific)

    print(serializer.data)
    print(len(json.dumps(serializer.data)))
    print(len(connection.queries))


if __name__ == "__main__":
    main()
