Giter Club home page Giter Club logo

Comments (7)

fabiocaccamo avatar fabiocaccamo commented on May 13, 2024 2

@zuck thanks for the suggestion, I think it is an useful feature and it could be extended to external js too.
I will add it in the next release, if you have any other idea feel free to suggest it.

from django-admin-interface.

merwok avatar merwok commented on May 13, 2024

Ping here! I could try making a PR if that helps.

from django-admin-interface.

fabiocaccamo avatar fabiocaccamo commented on May 13, 2024

@merwok as you can see here there is an old unused field that in the past was used to store custom extra css.
The textarea fields containing the css/js code could work, but it is terrible to have working code pasted in a textarea (like many systems does).

Now the necessity seems to have the possibility to upload a custom css file and why not, also a custom js file.

The best solution would be to add an additional model with a css/js file using a foreign key to the theme, but I think that this solution would go to over engineering the db for doing a simple thing. So, I would add two fields to the theme model: extra_css and extra_js (with file extension validator).

Let me know what do you think about it.

from django-admin-interface.

merwok avatar merwok commented on May 13, 2024

I think I misunderstood the original request!

I don’t want to import extra CSS; I already do customizations that I need (mostly on object add/edit page) with extra JS and CSS in overriden admin/change_form.html templates. What I’d like is to move all the admin-interface CSS from the HTML template into a CSS template, so that the HTML pages only need link rel=stylesheet. It would make the source shorter (good for view source!) and let the browser cache the stylesheet (using the appropriate cache headers based on a checksum or version, for invalidation).

from django-admin-interface.

9mido avatar 9mido commented on May 13, 2024

There should be no inline javascript/css at all. It is better to not have anything inline to follow content security policy best practices.

from django-admin-interface.

fabiocaccamo avatar fabiocaccamo commented on May 13, 2024

@9mido see #93

from django-admin-interface.

fabiocaccamo avatar fabiocaccamo commented on May 13, 2024

@zuck the solution suggested by @merwok solves your problems?

If not, could you be more specific about what you would like to do but you can't do?

Frankly it is my intention to close this issue because I don't want to add some potentially dangerous fields (a user with theme permissions could inject malicious code that would be executed by all users in all pages).

from django-admin-interface.

Related Issues (20)

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.