def manage_apps(request): from cartoview.version import get_backward_compatible, get_current_version apps = App.objects.all() context = { 'apps': apps, 'site_apps': get_apps_names(), 'version_info': { 'current_version': get_current_version(), 'backward_versions': get_backward_compatible() } } return render(request, 'app_manager/manage.html', context)
def test_view_uses_correct_template(self): resp = self.client.get(reverse('check_version')) self.assertEqual(resp.status_code, 200) self.assertTemplateUsed(resp, 'cartoview/check_version.js') self.assertEqual("current_version" in resp.context, True) self.assertEqual("latest_version" in resp.context, True) _version = parse_version(get_current_version())._version release = _version.release version = [str(x) for x in release] current_version = ".".join(version) req = requests.get("https://pypi.org/pypi/cartoview/json") latest_version = str(req.json()["info"]["version"]) self.assertEqual(resp.context["current_version"], current_version) self.assertEqual(resp.context["latest_version"], latest_version)
def manage_apps(request): from cartoview.version import get_backward_compatible, get_current_version from pkg_resources import parse_version apps = App.objects.all() _version = parse_version(get_current_version())._version release = _version.release version = [str(x) for x in release] context = { 'apps': apps, 'site_apps': get_apps_names(), 'version_info': { 'current_version': ".".join(version), 'backward_versions': get_backward_compatible() } } return render(request, 'app_manager/manage.html', context)