Comments (17)
Thanks, good idea, will implement.
As a temporary workaround you can use MENU_ORDER to set custom app name, but then you'll have to redefine all the app models: http://django-suit.readthedocs.org/en/latest/configuration.html#menu-order
from django-suit.
+1: That is such an omission from default Django that it's mind boggling that it's not a default feature...
from django-suit.
+1 my Only feature request for django-suit
from django-suit.
Anyone already implementing this? I'm interested in hacking on django-suit. This might be a nice first project.
from django-suit.
I'll get on this today evening
from django-suit.
By expanding menu features, I am thinking of rewriting menu config to a new parameter instead of adding new APP_NAMES
. I would like to make one config for menu, so that all menu is in one place and not separately (like icons, names and order). Also these nested tuples are quite hard to maintain and not quite readable.
Zen of Python :)
Beautiful is better than ugly.
Simple is better than complex.
Flat is better than nested.
Readability counts.
For backwards compatiblity i'll leave current menu config for a while
My proposal would be:
SUIT_CONFIG = {
'MENU': (
{'app': 'sites', 'icon': 'icon-leaf'},
{'app': 'sites', 'label': 'Our sites'},
{'label': 'Custom parent', 'url': '/admin/custom/', 'icon': 'icon-fire'},
{'label': 'Custom parent2', 'url': 'admin:index', 'icon': 'icon-globe',
'permissions': 'auth.add_group'},
{'app': 'auth', 'icon': 'icon-lock',
'models': (
'user', 'cms.page',
{
'label': 'Custom child',
'url': 'admin:custom_child',
'permissions': 'auth.add_user'
} )
}
)
}
What do you think?
from django-suit.
I like it, from the zen of python, explicit is better than implicit is also achieved here. Thou at first sigh is not clear to me what does 'auth.group' does in this bit:
{'app': 'auth', 'icon': 'icon-lock',
'models': (
'user', 'auth.group',
{
'label': 'Custom child',
'url': 'admin:custom_child',
'permissions': 'auth.add_user'
} )
}
Everything else is self explanatory and i love that.
from django-suit.
'auth.group'
was example, how you can "cross-link" models - add models from different apps into current app menu, to do that you must specify also app_name prefix. Some other app prefix would be more clear for sample code, i changed it to cms.page
in sample.
from django-suit.
Two suggestions:
- Use classes instead of nested dictionaries. Like werkzeug does for routing: http://werkzeug.pocoo.org/docs/routing/#quickstart Quite as readable and a hundred times more flexible.
- Use lists for readability where things get nested, and things of length 1. This is probably only a matter of how you do it in documentation but it sets an example.
['foo']
instead of('foo',)
[('foo', 'bar'), ('spam', 'eggs')]
instead of(('foo', 'bar'), ('spam', 'eggs'))
from django-suit.
- Importing custom classes into settings modules is generally a bad idea
- The problem wasn't so much in tuples as evolving menu needs better and more general config, rather that 3-4x different settings than control one thing. Some icons are set in MENU_ICONS, some are set in MENU_ORDER and so on. What i wanted is consistency.
What's wrong with new approach using dictionaries with human readable and self-explanatory keys?
from django-suit.
Importing stuff in settings is bad. True.
I just expect the configuration format to change a few more times and that gets much easier if you don't have to "guess" what version of configuration is used. Plus you don't have to write a configuration parser if you use classes.
The tuple thing is completely independent of the other issue. Was just a remark.
from django-suit.
Configuration format won't change in future, some additional keys may appear, but i see no reason why it must change again. Current MENU_ORDER and MENU_ICONS params will be deprecated and supported only for a while.
from django-suit.
Maybe because some user asks for a new feature that can't be expressed with the current configuration format... :)
from django-suit.
I think classes would be overkill for the current need, and a case of premature optimization. I think the use of lists does help readability.
from django-suit.
BTW I just started #django-suit channel on irc.freenode.net if anyone want to chat and discuss some features or anything related to Django Suit
from django-suit.
@jonashaag could you please test latest develop branch version for all your reported issues on menu including:
named apps, named models, model links, separators
Docs: http://django-suit.readthedocs.org/en/develop/configuration.html#id1
from django-suit.
Let's move discussion of the menu config to another thread. #52
from django-suit.
Related Issues (20)
- Sidebar is not properly showing HOT 3
- Almost a year without any new merges? HOT 3
- Chosen list in filtered manytomany field is too small to see any chosen selections
- Error 500 on demo HOT 1
- Missing arrow on select with suitv2
- Django Suit v2 Date Inline not showing calendar
- Unable to test an admin action with suit installed HOT 1
- when use npm run build,get a error
- Django Admin Hide Superuser User HOT 1
- Template Issue Filter position v2 HOT 4
- v2 suit tabs not working HOT 1
- Any V1 forks that support Django 3x? HOT 16
- RTL support
- V2 forks on bootstrap5 : need help HOT 2
- add subitems for the suit menu subitems(3 level tree)
- Row styling failing silently?
- object-tools actions not rendered
- Can't Login Into Admin Portal
- Cant see hours for last row in calendar
- Does the tab page contain data changes? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-suit.