alesdotio / django-admin-shortcuts Goto Github PK
View Code? Open in Web Editor NEWAdd simple and pretty shortcuts to the django admin homepage.
License: Other
Add simple and pretty shortcuts to the django admin homepage.
License: Other
I am getting this error:
'str' object does not support item assignment
on the line 8 of admin_shortcuts/templates/admin/index.html:
6 {% block breadcrumbs %}
7 <div class="admin_shortcuts">
8 {% admin_shortcuts %}
9 </div>
10 {% endblock %}
Any ideas?
I've customized my admin app. Copied base.html, base_site.html and index.html to my app. Shortcuts doesn't work at all when you do that - the settings are just ignored. So I copied index.html, templates/admin_shortcuts, static/admin_shortcuts, static/.DS_Store and the template_tags folder to my app. Now I get KeyError at /admin/:
Error during template rendering
In template c:\shop\ccmr-joe\templates\admin\index.html, error at line 8
The project should probably check for permissions, before displaying the link - like the admins does.
Hi,
I install django-admin-shortcuts via PIP and when I add 'admin_shortcuts' to your INSTALLED_APPS, just before 'django.contrib.admin', on my admin site I have this error
I use django-grappelli, maybe that I have this error.
TemplateSyntaxError at /admin/
'admin_shortcuts_tags' is not a valid tag library: ImportError raised loading admin_shortcuts.templatetags.admin_shortcuts_tags: No module named importlib
Request Method: GET
Request URL: http://blog.webbay.eu/admin/
Django Version: 1.4.1
Exception Type: TemplateSyntaxError
Exception Value:
'admin_shortcuts_tags' is not a valid tag library: ImportError raised loading admin_shortcuts.templatetags.admin_shortcuts_tags: No module named importlib
Exception Location: /usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py in load, line 1043
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/home/kolo86/blog',
'/usr/local/lib/python2.6/dist-packages/django_xmlrpc-0.1.4-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/distribute-0.6.32-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages',
'/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/pymodules/python2.6']
Server time: Śr, 26 Gru 2012 13:37:31 +0100
I don't know if this should be considered a bug due to the sheer age of Django 1.3 but since this package supports Django 1.2 upwards I think it should be mentioned that there are some bugs in the templates and how to solve them for people who come across them.
{% load i18n admin_static admin_shortcuts_tags %}
must be changed to
{% load i18n adminmedia admin_shortcuts_tags %}
------- // -------
<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />
must be changed to
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/dashboard.css" />
{% for class in classes %}.admin_shortcuts .shortcuts li a.{{ class }} { background-image: url('{% static "admin_shortcuts" %}/{{ class }}.png'); }{% endfor %}
must be changed to
{% for class in classes %}.admin_shortcuts .shortcuts li a.{{ class }} { background-image: url('{% get_static_prefix %}admin_shortcuts/{{ class }}.png'); }{% endfor %}
Other than that it seems to work fine. Thank you for an awesome package 👍
is it possible to enable the right to left option?
So the doco doesn't say that you need a context in your admin_shortcuts but the code does
line 20 in:
admin_shortcuts/templatetags/admin_shortcuts_tags.py
I've removed that line in mine as it was causing a keyerror
Please excuse me if I've done something wrong I'm new to git
It would be useful to be able to use count
and count_new
at the same time. For example by placing the count
value just below the title.
I may be a tad stupid but the instruction on how to change icons was pretty baffling. Turns out you go to site-packages/templatetags/admin_shortcuts_tags.py and add to CLASS_MAPPINGS. In my case I wanted the url 'transcription_project_changelist' to use the archive icon (in lieu of something better). So I added
['project', 'archive'],
to the bottom of the list. Didn't work. After some fiddling around I finally realized that the code iterates thru the list and returns the first match, which, since mine was at the end, was
['change', 'pencil'],
Solution: put my choices at the top. Works like a charm.
(previous conversation moved here)
It's not possible at the moment, but it would probably be easy to add by changing the admin/base_site.html template to include something like this at the top:
{% load admin_shortcuts_tags %}
{% block breadcrumbs %}
{% block extrastyle %}<style type="text/css">{% admin_shortcuts_css %}</style>
{{ block.super }}
{% endblock %}
{% block extrahead %}{{ block.super }}{% admin_shortcuts_js %}{% endblock %}
Adding the above code to base_site.html will not work because of other templates overriding the breadcrumbs tag.
So, there are two options to make this work:
the above code can be implemented in base.html BUT by removing the breadcrumbs tag and adding the actual admin_shortcuts_css tag and admin_shortcuts_js tag to the already existing block_extrastyle and block_extrahead tags appropriately. This is kind of hacky though because alot of other templates i.e. change_form, change_list, and app_index all are using the breadcrumbs tag. This leads to those other templates going to render the breadcrumbs tag but there is none in the parent template.
a cleaner approach is to do the above code change NOT in base.html and actually in the templates you wish to override them in i.e. change_form,change_list, and app_index.
This appears to be written to appear on the index page only. I made a feeble attempt to use it in all admin pages by changing
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
{% if title %} › {{ title }}{% endif %}
</div>
{% endblock %}
in the admin base.html to
{% block breadcrumbs %}
<div class="admin_shortcuts">
{% admin_shortcuts %}
</div>
{% endblock %}
but I get
Invalid block tag: 'admin_shortcuts', expected 'endblock'
Any chance this is an easy fix?
Is this plugin compatible with django version 2.0?
Hello Ales,
I’ve tried this nice app and I’ve noticed that icons are more-less required, at least I did not find possibility to not add any icon. Also links to font awesome resources are hardcoded in extrastyle block, base_site.html file.
Is it possible for you to add possibility to override these hardcoded resources and option to not include any icons intentionally (without magical guess)?
I would like this feature for internal / intranet / maybe even offline application where reaching external Font Awesome website may cause problems.
some icons are not aligned correctly, for example 'mail'
Running pip install django-admin-shortcuts
throws me this error. I suppose it has to do with the Python version as installing on a Python 3.6 environment doesn't raise issues.
Python version: 3.4
Package Version: 2.0.0
I've fixed it temporarily by installing version 1.2.7
Can this be fixed?
Thank you
Collecting django-admin-shortcuts
Downloading https://files.pythonhosted.org/packages/75/8b/9496dae0c9e08272c4ae73671ffeda14d29caf219bd6045d92a7dc265963/django-admin-shortcuts-2.0.0.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/django_admin_shortcuts.egg-info
writing requirements to pip-egg-info/django_admin_shortcuts.egg-info/requires.txt
writing pip-egg-info/django_admin_shortcuts.egg-info/PKG-INFO
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ks80gcmj/django-admin-shortcuts/setup.py", line 28, in <module>
keywords='',
File "/projs/<project>/env/lib/python3.4/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/projs/<project>/env/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 271, in run
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
File "/projs/<project>/env/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 604, in write_pkg_info
metadata.write_pkg_info(cmd.egg_info)
File "/usr/lib/python3.4/distutils/dist.py", line 1108, in write_pkg_info
self.write_pkg_file(pkg_info)
File "/projs/<project>/env/lib/python3.4/site-packages/setuptools/dist.py", line 91, in write_pkg_file
long_desc = rfc822_escape(self.get_long_description())
File "/usr/lib/python3.4/distutils/util.py", line 470, in rfc822_escape
lines = header.split('\n')
TypeError: Type str doesn't support the buffer API
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-ks80gcmj/django-admin-shortcuts/
Thank you for this great plugin.
I am using django-admin-interface and django-admin-shortcuts
caused a theme change in the index.html pages.
The solution I have found is the following:
/admin/index.html:
{% extends "admin:admin/index.html" %}
{% load i18n admin_static admin_shortcuts_tags %}
{# django-admin-shortcuts changes these blocks #}
{% block breadcrumbs %}
<div class="admin_shortcuts">
{% admin_shortcuts %}
</div>
{% endblock %}
{% block extrastyle %}<style type="text/css">{% admin_shortcuts_css %}</style>
{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />
{% endblock %}
{% block extrahead %}{{ block.super }}{% admin_shortcuts_js %}{% endblock %}
{# end changes #}
Hi - the new version 2.0.0 overwrites the admin/base_site.html which is also overwritten by djangocms_admin_style.
Unfortunately only one can take precedence.. I've started on a fix (https://github.com/mcldev/django-admin-shortcuts) that will create a second app 'admin_shortcuts_django_cms' (can be called whatever)... that will create overrides of DjangoCMS Admin Style specific templates only, leaving their base_site template.
There are still some formatting issues - but they could be handled by DjangoCMS Admin Style?
Hey there!
Thank you for your great work here, I really like the idea!
Unfortunately it looks like it doesn't work with Grappelli, right?
Cheers
i think the admin page gets cached and so do the shortcuts resulting in count being wrong
Hello
Now that I have the pip module installed in site-packages/ I want to modify index.html.
This is outside of my project folder and my GIT repository.
What is the right way to apply the changes?
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.