Search code examples
djangodjango-formsdjango-admindjango-imagekit

Django Admin - customize use jquery inside and custom fields


I want to implement in Django Admin a jquery plugin that "adjust" and image(http://guillotine.js.org/), them get the coordinates with ImageKit and save the new image.

I need some tutorials and advises how to do it.


Solution

  • I have no tutorials, but can give you advice.
    You can customize your admin model with custom css and js, by Media class, like so:

    class MyModelAdmin(admin.ModelAdmin):
    
        class Media:
            css = {
                "all": ("my_styles.css",)
            }
            js = ("my_code.js",)
    

    You can look in dev tools, how Django chose names id's and classes for elements in page and also check the docs.
    Admin docs