Tuesday, February 25, 2014

Re: Override grappelli js files

2014-02-25 17:18 GMT-03:00 rush <django@irush.su>:
Hi,

I'm using grappelli and I have two files in it I need to modify:

admin/js/SelectBox.js  admin/js/SelectFilter2.js

I thought it would be a good idea to put it into my app static directory:

my_app/static/admin/js/SelectBox.js  my_app/static/admin/js/SelectFilter2.js

But whenever I try ./manage.py collectstatic files from my_app are overrided by original files from grappelli, however I need it vice versa.

I need just to add several strings in this files into existing functions, so I can't handle it within a new js files and include into Media class ( from my point of view ).

Is there any way to override grappelli files?


When collecting static files, if there are multiple files with the same name Django will pick the first one it finds. [1] What that means is, unless you've changed STATICFILES_FINDERS, files inside folders in STATICFILES_DIRS will have the highest priority. And if static files inside apps are used, Django will follow the INSTALLED_APPS order, meaning you probably have grappelli _above_ my_app.

If for whatever reason you don't want/can't change the order your apps appear in INSTALLED_APPS, you may consider placing those files in a folder using STATICFILES_DIRS.

[1] https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-STATICFILES_FINDERS

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP5dYfP7pmXZsR592gx%2Bp%3DND1w9__Jq%3Dyzxnok2BFj5Gsi1rsw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment