old_contents: # -*- coding: utf-8 -*-
  import requests
  from django.shortcuts import render
  
  from .log_handler import get_logger
  from .version import get_current_version
  
  logger = get_logger(__name__)
  
  
  def index(request):
      context = {}
      return render(request, 'site_index.html', context)
  
  
  def check_version(request):
      r = requests.get("https://pypi.org/pypi/cartoview/json")
      context = dict(
          latest_version=r.json()["info"]["version"],
          current_version=get_current_version())
      return render(
          request,
          "cartoview/check_version.js",
          context=context,
          content_type="text/javascript")
  
new_contents: # -*- coding: utf-8 -*-
  import requests
  from django.shortcuts import render
  from pkg_resources import parse_version
  
  from .log_handler import get_logger
  from .version import get_current_version
  
  logger = get_logger(__name__)
  
  
  def index(request):
      context = {}
      return render(request, 'site_index.html', context)
  
  
  def check_version(request):
      r = requests.get("https://pypi.org/pypi/cartoview/json")
      _version = parse_version(get_current_version())._version
      release = _version.release
      version = [str(x) for x in release]
      current_version = ".".join(version)
      context = dict(
          latest_version=r.json()["info"]["version"],
          current_version=current_version)
      return render(
          request,
          "cartoview/check_version.js",
          context=context,
          content_type="text/javascript")
  
subject: return js compatible version in check_version