Exemplo n.º 1
0
def configuration(request):
    if user_is_authenticated(request.user):
        site = AdminSite()
        data = site.each_context(request)
        data['available_apps'] = build_app_dict(request)
        all_apps = []
        for pkg in pip.get_installed_distributions():
            all_apps.append({'key': pkg.project_name, 'version': pkg.version})
        data['title'] = _('Configuration')
        data['all_apps'] = sorted(all_apps, key=lambda k: k['key'])
        data['migrations'] = get_all_migrations_status()
        return render(request, 'admin/config.html', context=data)
    return redirect(reverse('admin:login'))
Exemplo n.º 2
0
def about(request):
    site = AdminSite()
    # base_url = "https://pypi.python.org/pypi/"
    data = site.each_context(request)
    avai = _build_app_dict(request)
    app_list = sorted(avai.values(), key=lambda x: x['name'].lower())
    data['available_apps'] = app_list
    all_apps = []
    for pkg in pip.get_installed_distributions():
        # url = base_url + pkg.project_name + "/json"
        # req = requests.get(url)
        # pkg_data = json.loads(req.text)
        # latest_version = pkg_data['info']['version']
        all_apps.append({'key': pkg.project_name, 'version': pkg.version})
    data['title'] = 'About'
    data['all_apps'] = sorted(all_apps, key=lambda k: k['key'])
    data['migrations'] = remaining_migrations()
    return render(request, 'admin/about.html', context=data)