darklow / django-suit Goto Github PK
View Code? Open in Web Editor NEWModern theme for Django admin interface
Home Page: http://djangosuit.com/
License: Other
Modern theme for Django admin interface
Home Page: http://djangosuit.com/
License: Other
Please suggest packages you would like to be supported. Also vote for packages that are already suggested, so we know which are most wanted. Thank you.
I deleted comments with apps that have been already implemented. Here is the list of currently supported apps:
Documentation and examples:
http://django-suit.readthedocs.org/en/develop/#supported-apps
Another edge case:
Given the following models:
from django.db import models
class House(models.Model):
address = models.TextField()
class Floor(models.Model):
number = models.IntegerField()
class FloorRel(models.Model):
house = models.ForeignKey(House)
position = models.IntegerField()
floor = models.ForeignKey(Floor)
class Room(models.Model):
CHOICES = (
(1, 'One'),
(2, 'Two'),
)
house = models.ForeignKey(House)
position = models.IntegerField()
name = models.CharField(max_length=100, blank=False)
beds = models.IntegerField(choices=CHOICES, default=1)
And the following admin:
from django.contrib import admin
from demo.sortables.models import House, Room, Floor, FloorRel
from suit.admin import SortableModelAdmin, SortableTabularInline
class RoomInline(SortableTabularInline):
sortable = 'position'
model = Room
class FloorInline(admin.TabularInline):
model = FloorRel
class HouseAdmin(admin.ModelAdmin):
inlines = [RoomInline, FloorInline]
admin.site.register(House, HouseAdmin)
If you create / edit an object, you'll find sorting arrows at the FloorInline 'position' field, even though the FloorInline does not extend from SortableTabularInline
And use travis-ci.org
Django Suit currently allows you to use Bootstrap tabs however the functionality within Django is limited. It would be a great feature for crowded forms to map (collections of) fieldsets to tabs.
This will probably have impact on form handling in the admin but would give much more flexibility in designing forms and would create a much better user experience.
First feedback: AWESOME! This is really great stuff. Works very well! A few minor things:
'url': 'app.model'
, the active menu item is only highlighted on the model list page, not on instance edit form pages.'/'
is a good indicator for a separator. Why not use something explicit, maybe 'SPACER'
or '---'
?'url': 'app.model'
seems a bit like magic to me: If the model in question is not found, you'll just the get URL /app.model/
as link target. I suggest making things more explicit here too, maybe using 'model': 'myapp.mymodel'
.Seems there is several old syntax usage in django-suit
File "suit/templatetags/suit_list.py", line 21
return u'<li class="disabled"><a href="#" onclick="return false;">..' \
^
SyntaxError: invalid syntax
File "suit/templatetags/suit_tags.py", line 60
displayed = u"<a href='%s'>%s</a>" % (admin_url, displayed)
^
SyntaxError: invalid syntax
File "suit/widgets.py", line 28
u'<div class="input-append suit-date">%s<span '
Would be useful to be able to select all the checkboxes in a list - even if just for a single page
Add option to replace widgets globally, i.e. in all admin change forms. For example, I'd like to replace all textareas with auto-sized textareas.
The setup script imports VERSION
number from the __init__.py
package file.
Besides the version number, the __init__.py
module also contains a bunch of code that is executed whenever DJANGO_SETTINGS_MODULE
environment variable is defined and relies on the project settings being correctly configured.
It is not a safe assumption that a valid settings file and all dependencies will be available during the setup stage, even though the DJANGO_SETTINGS_MODULE
variable is defined. While it may seem convenient to retrieve the package version number from the package itself, the setup script will be way more reliable if it simply hardcodes the number and does not rely on the package code import and related dependencies.
I propose to drop the "Info!" string added to default info messages - or any additional strings to default messages like warnings and errors for that matter.
As the styling provided by Bootstrap is consistently applied throughout Django Suit, this string looks rather unnecessary and not particularly pretty. My users know that a blue styled message indicates an informational signal from the application.
Alternatively replace the string with one of Glyph icons available in Bootstrap which would look much more polished, although I think they're not really necessary.
Add a config option to rename apps, e.g.
SUIT_CONFIG = {
...
'APP_NAMES': {
'auth': "Users and Groups",
'flatpages': "Static sites",
},
...
}
I changed change_form.html
to include extra buttons and noticed that the bottom button now has an extra separation line which is not visible in the default setup with only two buttons ("History" and "Add ...").
Not too sure whether this is an Django Suit issue, but I could not find any special styling for the last button.
Just a minor issue...
In vanilla django admin if you add an inline to your ModelAdmin you get in a plus sign to add multiple inlines before saving, in django-suit you have to add one, save and continue editing, add another, save and continue editing and so on.
For those of you who can't see vanilla django admin here is an example of what would be seen.
http://blogs.law.harvard.edu/rprasad/files/2011/08/tabular_inline1.png
Hi darklow,
Thanks for django-suit! It's a nice admin theme and I appreciate your approach using Bootstrap. I am glad you're working on the Sortable feature, but unfortunately found two issues:
AttributeError:
type object 'ModelForm' has no attribute 'Meta'
in suit/admin.pu r.54:
self.form.Meta.widgets[self.sortable] = SortableListForm.Meta.widgets[
Form validation error on empty inline objects.
.. probably because the SortableTabularInline sets the sortable field?
Hope you can take a look at this!
Replace all browser windows (e.g. the popup browser windows you get when clicking the green + icon ) and browser alerts (e.g. the Abandon Changes alert) with dialogs rendered by Bootstrap. Browser windows and alerts are very previous decade. They look horrible and in my opinion break the clean interface supplied by Bootstrap.
The search field in the top location of the menu bar (very handy, I like it) has a different styling from the search field that appears on change_list.html. If possible apply same styling to search field in change_list.html.
To improve the end user experience, add a more meaningful placeholder value in the search fields. At the moment it's anybody's guess on what attributes a search is actually performed. I think this is a standard Django short coming as, if I remember correctly, the standard admin doesn't show any placeholder values either.
The search field in the top part of the menu could be improved -possibly- with a drop down button that allows the user to choose the search target. The config could be adapted to something like:
'SEARCH_URL': (
('/admin/bookings/booking/', ('Search bookings', 'Guest name')),
('/admin/properties/property/', ('Search properties', 'Property name'))
... more search options...
)
The first entry should be the default setting. First value is the url towards which the search is performed, the second value is the option that appears in drop down and last one is the placeholder value to display in the search field. Upon selection from the drop down, the search field sets its parameters according to the config values.
A really cool feature would be to retain a search history, accessible via the same drop down that sets the search target. The history is session bound and disappears when the session dies/ends. Historic searches can be re-applied by simply selecting them from the drop down. Maybe that's pushing the boat a bit too far, but it would be cool...
Move the menu search from the menu area into the top banner and just display the magnifying glass icon. Clicking the icon will pop out a small form with the search field much like the Spotlight feature of OS X. The menu bar is a rather cramped area for hosting a meaningful sized search field in my opinion.
If you want separate issues, just comment and I'll split them up.
It would be good if we could define a page to redirect to after login.
As all areas can be accessed via the sidebar the "home" menu item and page almost become redundant (apart from "my actions"). If we could redirect to one of our apps and remove the "home" link it could help clean up the interface.
With regard to the sortables feature:
Given the following models:
from django.db import models
class House(models.Model):
address = models.TextField()
class Room(models.Model):
CHOICES = (
(1, 'One'),
(2, 'Two'),
)
house = models.ForeignKey(House)
position = models.IntegerField()
name = models.CharField(max_length=100, blank=False)
beds = models.IntegerField(choices=CHOICES, default=1)
And the following admin.py:
from django.contrib import admin
from demo.sortables.models import House, Room
from suit.admin import SortableModelAdmin, SortableTabularInline
class RoomInline(SortableTabularInline):
sortable = 'position'
model = Room
class HouseAdmin(admin.ModelAdmin):
inlines = [RoomInline]
admin.site.register(House, HouseAdmin)
When I try to add a house, without any rooms, the admin reports 'This field is required.' for each name field in the room inline which only has the default value for 'beds' provided.
Apparently, these default values do not pass the ":input[value!=''][type!='hidden']" selector, so the sortable field is set, resulting in Django complaining about empty fields.
In the following examples, resolve app.model
to /admin/app/model/
:
[("Custom parent", 'app.model')]
[("Custom parent", '/some/link/'), [("Child 1", 'app.model')]]
If a add the 'wide'
CSS class to a fieldset, django-suit should behave similar to how Django does: increase the fields' width.
I quite like the EnclosedInput widget in DS. I needed to apply that to a numeric input field which represents monetary amounts (a specific currency). The value of the currency (GBP, USD, EUR etc.) would be determined by the object that is being edited in the form and is not uniform for each model object. Some are administered in EUR, others in GBP etc...
To get this to work, I created the following init on my form:
def __init__(self, *args, **kwargs):
currency = None
if kwargs.has_key("instance"):
# Instance is the model object being edited by the form. The currency attribute will have a None value when it is a newly entered instances as the currency property has not been set yet.
model = kwargs["instance"]
currency = model.currency
if currency is None:
# TODO: Replace this with a default currency from application settings; hard coded for now...
currency = "GBP"
super(PropertyForm, self).__init__(*args, **kwargs)
self._meta.widgets["amount"] = EnclosedInput(
prepend = currency,
attrs = {
'style': 'text-align: right;',
'class': 'input-small',
}
)
The above works but with a flaw. Upon initial display of the form, the EnclosedInput is being ignored and a plain input is being rendered. I have to use the browser Reload button, sometimes two times, to get the EnclosedInput rendered correctly with the currency prepend. Remarkable enough, when I set a breakpoint in order to debug this, this does not happen and the EnclosedInput widget is rendered correctly immediately. This makes it difficult to detect where the root of the problem lies.
Any ideas??
Many thanks...
Would be cool to be able to disable icons entirely or only for some links:
'MENU_ICONS': None, # disable icons entirely
'MENU_ICONS': {'auth': None}, # disable for auth
'MENU_ORDER': [("Foo", '/link/', None)] # no icon for custom link
It would be great to have django-cms support. It's functional in it's current form but has a bunch of styling issues.
If a model has has_add_permission method set to False...
class MyModelAdmin(admin.ModelAdmin):
def has_add_permission(self, request):
return False
...making "+Add" not displaying, the table for this model shrinks and becomes uneven in regard to other models. I don't know how to describe it better so I'll just attach an image.
First version of sortable inlines will support only "arrows" for sorting.
Drag and drop support will be added in some future versions.
There's a hard set width constraint of 200px for the div named "branding" which displays the value of the setting ADMIN_NAME in the banner.
Although this aligns nicely with the width of the column that holds the menu, it's practically not very convenient. With its larger font setting, any value will soon overflow and the overflow will not be visible leaving a crippled view of the branding.
My suggestion would be to remove that 200px constraint, let the content of the div named "branding" flow into the banner freely and move the div that displays current date and time to the right of the banner.
The Django admin has its own login page, no matter what you define for LOGIN_URL
. Whereas django-suit does not seem to have such thing. Thus, if I'm not logged in and visit mysite.com/admin/
, I get redirected to the site's frontend login page, which in turn redirects to the site's frontend after-login page (LOGIN_REDIRECT_URL
). I have to visit the admin URL a second time to get into the admin.
To improve the end user experience, add a more meaningful placeholder value in the search fields. At the moment it's anybody's guess on what attributes a search is actually performed. I think this is a standard Django short coming as, if I remember correctly, the standard admin doesn't show any placeholder values either.
Not so much a bug but more a suggestion: there should be a more elegant option for the sorting tools in table columns. When you have narrow columns that have sorting, the sorting controls look bad and mess up the table header appearance.
Maybe have a small button that pops out the sorting options in stead of displaying them at all times in the column header??
Please share you ideas on how should we make alternative dashboard for Django Suit (besides original apps list).
What options should be there, how you should define what's in dashboard.
What dashboard widgets/blocks should be there available by default.
Because needs can differ so much.
Thanks.
It would be a great feature to have the possibility to add styles from Bootstrap -or any CSS styles for that matter- to individual rows in an admin list. If you take this one step further one could also add styles to individual fields.
At this moment this is not possible as the list in Django admin is built by a single admin tag that builds the list -basically a HTML table- from the definitions in admin.py.
The request
template variable is only available if django.core.context_processors.request
is in TEMPLATE_CONTEXT_PROCESSORS
, which is not the case by default.
If the variable is not available, the left sidebar menu will only have a 'Home' entry and all apps are missing.
This should be mentioned in the documentation.
Hi!
I have error at change list: http://pastebin.com/pjbnvqU7 ('ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). You passed in <django.utils.functional.proxy object at 0xa36c34c> (<class 'django.utils.functional.proxy'>))
I had not problem with grappelli.
When you define a field in the admin as read only, its help text is printed on the next line as opposed to next to the field value. For forms with lots of read only fields this will make the form look a bit silly, but more importantly will waste a lot of real estate.
Not sure whether feasible nor aesthetically pleasing, a better solution might be to have help texts float to the right on the same level as the widget/value they belong to.
# Suggestion
SUIT_CONFIG = {
'MENU_ORDER': (
('sites', ),
('auth', ('user', 'group',
{'name': 'Registration', 'url': '/custom_location/'}
)),
(('Custom group', '', 'icon-fire'), ('crm.contact', 'auth.user')),
(('Logout', 'admin:logout', 'icon-remove'),), # or '/admin/logout'
)
}
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.