Code Monkey home page Code Monkey logo

django-grappelli's Introduction

Django Grappelli

https://github.com/sehmaschine/django-grappelli/actions/workflows/tests.yml/badge.svg?branch=master https://readthedocs.org/projects/django-grappelli/badge/?version=latest

A jazzy skin for the Django admin interface.

Grappelli is a grid-based alternative/extension to the Django administration interface.

Code

https://github.com/sehmaschine/django-grappelli

Website

http://www.grappelliproject.com

Documentation

https://django-grappelli.readthedocs.io/en/latest/

Releases

Grappelli is always developed against the latest stable Django release and is NOT tested with Django's master branch.

  • Grappelli 4.0.1 (April 25th, 2024): Compatible with Django 5.x
  • Grappelli 3.0.9 (April 25th, 2024): Compatible with Django 4.2 (LTS)

Current development branches:

  • Grappelli 4.0.2 (Development version for Django 5.0, see branch Stable/4.0.x)
  • Grappelli 3.0.10 (Development version for Django 4.0, see branch Stable/3.0.x)

Older versions are available at GitHub, but are not supported anymore.

django-grappelli's People

Contributors

atodorov avatar bertrandbordage avatar browniebroke avatar dmrz avatar efoken avatar etianen avatar fabiant7t avatar fetzig avatar floledermann avatar fourk avatar graingert avatar gugu avatar h3 avatar kurazu avatar maldn avatar maximdeclercq avatar mijamo avatar mikevl avatar mjafarmashhadi avatar myii avatar nnmware avatar paoloc68 avatar parsch avatar praus avatar raagin avatar sehmaschine avatar sonarun avatar strycore avatar tdruez avatar vinnyrose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-grappelli's Issues

IE compatibility

Sadly we're in a world where IE < 9 exists and in fact rules in corporations and government departments.

There are quite a few glitches using Grappelli on IE<9 (change_list search, edit_form footer blocks access to fields...). We have to give up on Grappelli for now.

It'd be nice to degrade gracefully for those users.

admin login 'loop' in safari

OS X 10.6, Safari 5.1.
Django 1.4 pre-alpha
grappelli 2.3.3

Issue: login process never proceeds beyond login page. When login credentials are submitted, page reverts to login page.
Cannot see any discernible errors in the Safari debug window. Same problem seen on iOS (iPad) Safari as well.

No problems with Chrome, Firefox on same machine. Grappelli works well on those machines.

getUserSetting not defined - tinyMCE

Django 1.3, grappelli 2.3.3, OS X 10.6.8, Chrome / Firefox.

I see an error in on pages using TinyMCE.
Uncaught ReferenceError: getUserSetting is not defined --- editor_plugin_src.js:12

Here is my relevant admin.py class

class Media:
    js = (
            settings.ADMIN_MEDIA_PREFIX+'tinymce/jscripts/tiny_mce/tiny_mce_src.js',
            settings.STATIC_URL+'filebrowser/js/TinyMCEAdmin.js',
           )

Symptoms - unable to insert images. The dialog opens properly, takes me to the filebrowser window, allows selection of various sizes of image. When I hit insert, all it adds to the HTML is:

 <div><img border="0" /></div>

(No src / height / width etc)

No changes to tinymce_setup.js.

add to docs

something like this:

To make sure Grappelli based admin pages are displayed correctly, make
sure you have removed all customized admin templates from all
locations in TEMPLATE_DIRS paths, or check that those edited templates
are compatible with Grappelli.

predefined/custom layouts

e.g., with the changelist, one might favour old-style-filters on the right hand side of the table. we could define some predefined templates to choose from ... and it should be easy to define a custom layout as well. of course, this should be available for every site (dashboard, changelist, changeform).

Apps not loading in dashboard

Apps/models are not loading in the dashboard on production server. Models in the built-in Django apps are loading. Installed apps are accesible by url (/admin/myapp/mymodel/), and the dashboard loads as expected using Django's runserver. The same problem is described in the comments on issue #34.

In settings.py Installed apps: myproject.myapp

In dashboard models are refereced like: myproject.myapp.models.MyModel

I am running Django 1.3.1 and Grappelli 2.3.4. The production server is uwsgi/cherokee.

Trigger events when inlines are added/removed

I have some JavaScript I need to run when a user clicks the "Add another " link in an inline form. My JavaScript needs to execute after the new inline form has been appended to the document, so a simple click() handler on the link won't work.

There doesn't appear to be an easy way to do this. For now I've resorted to using a gross hack with setInterval, where I monitor the page for changes.

It would be awesome if Grappelli fired events when inline forms are added or removed, for example:

$(document).bind('grappelli:inline:added', function(form) {
    // Do something with the newly added inline form.
});

This is a far less obtrusive style than passing callbacks into the $.grp_inline function.

If you agree with the style I propose, I'd be happy to submit patches.

#action-toggle checkbox broken in 2.3.5

This is the checkbox in that selects all rows. First click successfully selects all rows. Second clicks raises Javascript error:

Uncaught TypeError: Object checked has no method 'parent'
$.fn.actions.checker actions.min.js:19
$.fn.actions.lastChecked actions.min.js:73
f.event.handle jquery-1.6.2.min.js:17
f.event.add.i.handle.k jquery-1.6.2.min.js:16

Not working with non-integer ids

Please change grappelli/templatetags/grp_tags.py (line 30) to:

return_string = "%s'%s': {pk: '%s', app: '%s', model: '%s'}," % (return_string, c.id, c.id, c.app_label, c.model)

So to enable non-int ids (for e.g. non relational backends or even mysql backends with non-int ids)

Inline sortables - adds position index to untouched inline forms on save

If you have an inline form for model that has a select widget with default state (for example, models.NullBooleanField has a default stat of "Unknown") then Grappeli thinks that this form was edited and adds index to position input on save in all forms even if they were not touched/edited. Then Django thinks that inline formset contains additional forms with only position and select widget inputs edited. Of course these additional forms are wrong and must be all blank.

My particular case is

# models.py

class Site(models.Model):
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey()
    url = models.URLField(u'URL')
    is_official = models.NullBooleanField()
    position = models.IntegerField()

# admin.py

class SiteInline(generic.GenericTabularInline):
    model = Site
    extra = 5
    ordering = ('position',)
    sortable_field_name = 'position'
    verbose_name = Site._meta.verbose_name
    verbose_name_plural = Site._meta.verbose_name_plural

Custom admin app

Hi,

Not sure if I'm right here but I'm developing an admin app for mongodb documents. The Problem is that I need a custom change_list template. Which works fine with django's admin app but not with grappelli. I'd like to support both, though.

So, is there any way to find out in a third party app if the admin is grappelli and load a template for it?

Cheers,

Jan

missing images from admin/img/admin

Using django-treemenus with django-grappelli, it hits 404 in admin interface:

http://localhost:8000/static/grappelli/img/admin/arrow-down.gif 404

Solution is to copy all images from admin static files into static/grappelli/admin/img/admin/:

arrow-down.gif default-bg-reverse.gif icon_deletelink.gif inline-delete-8bit.png nav-bg-reverse.gif selector_stacked-remove.gif tooltag-arrowright.gif
arrow-up.gif deleted-overlay.gif icon_error.gif inline-delete.png selector-addall.gif tool-left.gif tooltag-arrowright_over.gif
changelist-bg.gif icon_addlink.gif icon-no.gif inline-restore-8bit.png selector-add.gif tool-left_over.gif
changelist-bg_rtl.gif icon_alert.gif icon_searchbox.png inline-restore.png selector-removeall.gif tool-right.gif
chooser-bg.gif icon_calendar.gif icon_success.gif inline-splitter-bg.gif selector-remove.gif tool-right_over.gif
chooser_stacked-bg.gif icon_changelink.gif icon-unknown.gif nav-bg.gif selector-search.gif tooltag-add.gif
default-bg.gif icon_clock.gif icon-yes.gif nav-bg-grabber.gif selector_stacked-add.gif tooltag-add_over.gif

Screenshots?

It would be nice to see some screen shots so I can instantly see some jazz.

filter_horizontal spanish localization issue

I don't know for sure if this localization is in grappelli itself or in django.contrib.admin

When you use filter_horizontal, the text on the right box that says:
"Select your choice(s) and click"
Is translated to:
"Seleccione la opción u opcione que desee elegir y haga click en"

Which has two problems:

  1. It should be "opciones" and not "opcione".
  2. It's too long and breaks the layout. Changing it to this would work: "Seleccione sus opciones y haga click en"

2.3.4 Autocomplete lookup unicode encoding issue

I encountered the following issue in localized system with encoding enabled:

Autocomplete was failing in lookup.

ww.foo.bar/grappelli/lookup/autocomplete/?term=p&app_label=clients&model_name=client&query_string=type__in=1&t=id%20500

Resulted in

TypeError at /grappelli/lookup/autocomplete/
filter() keywords must be strings
Request Method: GET
Request URL: www.foo.bar/grappelli/lookup/autocomplete/?term=p&app_label=clients&model_name=client&query_string=type__in=1&t=id%20500
Django Version: 1.3
Exception Type: TypeError
Exception Value:
filter() keywords must be strings
Exception Location: /home/foobar/virtualenvs/prime/lib/python2.5/site-packages/grappelli/views/related.py in autocomplete_lookup, line 101

Problem was similar in nature to this one:
https://code.djangoproject.com/ticket/4798

Solution:
Change the following in grappelli/views/related.py
Add line 10: from django.utils.encoding import smart_str

Change line 101:
filters[smart_str(item.split("=")[0])]=smart_str(item.split("=")[1])

This resolved the issue for me.

Jónas

Filter drop-down doesn't function due to Javascript error in Chrome, FF

I just installed django-grappelli 2.3.4 in combination with Django 1.4.0 alpha. All's fine, except for the filter drop-down box on the change list page. Chrome and Firefox report a Javascript error:

Uncaught TypeError: Object #<Object> has no method 'actions'
(anonymous function):8000/admin/msdb/incident/:59
c.extend.readyjquery-1.4.2.min.js:26
L

The relevant bit of code is in templates/admin/change_list.html. A fix seems to be moving the block

{% if action_form %}
  ...
{% endif %}

from line 19 down to line 65, right after {{ media.js }}. I believe this is because the actions.js script is loaded in the block contained by media.js, which comes after relevant Javascript code.

Not sure if this is a result of Django code still being in alpha, but figured I'd report it.

Another error occurrs at the same time by grp_collapsible in templates/admin/includes_grappelli/header.html:

Uncaught TypeError: Object #<Object> has no method 'grp_collapsible'

Don't know how to fix this one, though.

Use Twitter bootstrap instead of blueprint

For the grids and styles, would be great to use twitter bootstrap instead of blueprint as it will come out with more themes in near future and is more actively updated.

broken tinymce pagebreak plugin integration

When using the grappelli theme (and it seems I have to since the django-filebrowser popups are all broken otherwise) the tinymce pagebreak plugin appears to have two issues:

  1. icon on the tinymce toolbar is blank
  2. pagebreak in the editor doesn't manifest as visual pagebreak (I suspect a css rule wasn't carried over)

performance with autocomplete-lookup

this line
data = [{"value":f.pk,"label":u'%s' % get_label(f)} for f in model.objects.filter(**filters) if get_lookup(f,term)]
is inefficient and needs to be replaced.

autocompletes for fk, m2m & generic relations

autocomplete-field which needs to work with

  • foreign keys
  • many-to-many relationships
  • generic relationships

on both the change-form and the change-list.
moreover, the search-icon is necessary as well (since with an autocomplete, one might not receive all possible items in rare cases).

Grappelli login

The login screen does not show errors for invalid users or invalid passwords. Should this be so?
Thanks

Admin media clobbers Grappelli Jquery

I had a problem where my inlines could not be deleted. I've tracked it down to the fact that the original admin media is being included after all of the Grappelli JS etc and so various functions (grp_collapsible, etc) are effectively deleted. This results in the delete handlers not being created or firing.

If I move the call to {{ media }} in grappelli/templates/admin/change_form.html to be before the call to {{ block.super }} then the problem disappears but this is not the most elegant of solutions.

I am using admin_tools with grappelli; if I remove it then I get a crash on the dashboard page. I'm not sure if I have it placed in the correct order in my settings.py. Currently it looks like this:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'admin_tools.dashboard',
'grappelli.dashboard',
'grappelli',
'admin_tools',
'admin_tools.theming',
'django.contrib.admin',
...,
)

At the moment I believe that the inclusion of {{ media }} will always bring in the django.contrib.admin media, and so this problem will always occur.

I'm using Django trunk.

Orderable inlines :: order field is displaying

Our orderable inlines, which are still orderable by drag and drop, are 'not' hiding the order field, i.e.

order = models.PositiveInteger...

We've recently upgrade from django 1.2, grappelli etc. to django 1.3, grappelli 2.3.4

Browser moves to top of page after drag/drop tabular inline sortable

The browser view is reset to the top of the page each time I drag/drop a tabular inline sortable. I have to scroll back down to the inline section every time to see the change I made or move another inline. I would expect the view to stay the same so I can continue what I was doing.

I'm using the latest dev release of grappelli.
I'm using a FileBrowseField for one of the inline fields.
Repeatable in Safari, Chrome, and Firefox.

Official Sample Project?

Setting up Grappelli /w Filebrowser is easy enough... but perhaps including a sample project django project showcasing Grappelli and/or Filebrowser's features could be useful.

A sample project could serve as:
a) an illustrative model for the documentation
b) a quick way for potential users to explore grappelli and filebrowser features
c) the base for the official screenshots...

Could be generated with a management command...?
Maybe just a separate Github project?

Branches for current stable release, and trunk ?

Missing 'generic related lookup' icon in orderable inlines

We have an issue with 2.3.4 whereas we have generic related lookup, inside an orderable inline -- and, the 'magnifying glass' icon does not display.

I'm wondering if this feature works in a clean install of this version of grappelli -- on your end?

TinyMCE language files

Since grappelli is already shipping with TinyMCE, it would be convenient to include all the language files also. Since it can detect the user browser language, it would match Django's admin translations seamlessy.

dashboard.css?

My grappelli site is looking for a grappelli/css/dashboard.css but no such file exists in the grappelli/static folder of the installation, nor in the repo. Where is this supposed to come from?

pre_content and post_content currently commented out

grappelli/dashboard/templates/grappelli/dashboard/module.html

you have the following:

{# TODO: need to know in what dom we wrap the pre_content/post_content #}
{# if module.pre_content %}{{ module.pre_content }}{% endif #}

can you clarify what the issue is with the DOM?
I would be glad to try to write a patch if I understood the issue - I would like this functionality.

Preview image on edit view

Hello,

I use a ImageField for one of my model, but when I edit it on Grappelli, it shows me the link to this image but not the image. Can we change that? I only need a preview.

Thank you

Create RPM

In the master version there two file with spaces in the name that cause a broke rpm build. I suppose the two files are not needed for the app:

grappelli/static/grappelli/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin Kopie.js
grappelli/static/grappelli/tinymce/jscripts/tiny_mce/themes/advanced/skins/grappelli/content_grid copy.css

Removing these two files rpm build back to normal.

Inlines forms

Grappelli version: master branch (2.3.5)
Django version: r16855 releases/1.3.X

There is problem with the "inlines forms". If you use the "Add row" and then the "Remove row" and save model, it raises exception MultiValueDictKeyError.

Bug

Inline sortables are broken when there is only a file field

The Bug

We have the following model:

class MyModel(models.Model):
    parent = models.ForeignKey(OtherModel)
    image = models.ImageField(upload_to='images')
    ordering = models.PositiveIntegerField()
    class Meta:
        ordering = ['ordering']

With this admin code:

class MyModelForm(forms.ModelForm):
    ordering = forms.IntegerField(widget=forms.HiddenInput)
    class Meta:
        model = MyModel
        fields = ('image', 'parent', 'ordering')

class MyModelInline(admin.TabularInline):
    model = MyModel
    form = MyModelForm
    sortable_field_name = "ordering"

In this scenario, the inlines will only save the ordering data if a file has been chosen for upload.

Once the file has been uploaded and saved the ordering data won't be updated.

Why?

This is due to the way grappelli is check to see if an inline has data and the way files are handled.

In Django admin a file field with a file set will look like this:

Currently: <a href="/media/images/myimage.jpg">images/myimage.jpg</a> 
<input type="checkbox" name="images-1-image-clear" id="images-1-image-clear_id" /> 
<label for="images-1-image-clear_id">Clear</label><br />
Change: <input type="file" name="images-1-image" id="id_images-1-image" />

Grappelli uses the following code to find all the fields that need to have sorting information updated:

            $("#images-group").find("div.tbody.dynamic-form").each(function(){
                var fields = $(this).find("div.td :input[value]");
                if (fields.serialize()) {
                    $(this).find("input[name$='"+sortable_field_name+"']").val(i);
                    i++;
                }
            });

Because the file field and the checkbox for clearing it are empty fields.serialize() is false, therefore the sorting information isn't updated.

Compatibility with django-positions

There is great python module callsed django-positions.

I tried to use django-positions with django-grappelli for models with generic field in admin generic inlines. But there is a bug: there are SQL queries that are called by both Django admin and django-positions internal PositionField methods (incrementing/decrementing index). This results in unexpected indexes. For example, then you have 3 rows in generic inline and try to move the last row to first position, the rows get indexes 0, 2, 2 instead of 0, 1, 2.

cannot save, when deleting just added (not saved) inline item

cannot save, when deleting just added (not saved) inline item
it's caused by wrong selector in line 141 of file 'jquery.grp_inline.js':

while

inline = elem.parents("div.group")
...
inline.find("." + options.formCssClass).each(function() {
selects "dynamic-form" elements on many levels, enumerating not only rows, refreshing it with wrong id's
line 141 should be like:
inline.find("." + options.formCssClass +".tbody .tr").each(function() {

Additional click is needed to show auth form on admin login

Additional click anywhere on the page is needed to show username and password fields after accessing admin url.
Bug is reproduced on Chromium 12.0.742.112 (90304) Ubuntu 11.04, Chrome 12 and Safari 5.1.

Problem is that jQuery.focus() is not working in Chrome, Chromium and Safari.

Here is the fix:
grappelli/templates/admin/login.html

    (function($) {
        $(window).load(function(){ 
         $('#id_username').focus(); });
    })(django.jQuery);

change to:

    (function($) {
        $(window).load(function(){ 
         // Safari and Chrome is not firing .focus() event, so we fix it with toggleClass 
         $('#login-form').toggleClass("over"); 
         $('#id_username').focus(); });
    })(django.jQuery);

update docs

there are still links to googlecode - need to be replace with github.

Change url tags to the new {% url 'view' %}

Currently django-grappelli works with the pre-1.3 url template tag, that works if the user does not apply the "future" template module globally, but if not, grappelli stops working.

  • Problem: Grappelli does not work. URLs like admin:index are not parsed.
  • Environment: Globally imported "future" template module in settings.py spreading to all templates in the project environment.
  • Files with priority: templates/admin/base.html, templates/admin/includes_grappelli/headers.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.