2

I am trying out django-geoposition (actually, django itself). I would like to use my own version of the static file geoposition.js. So under my project, I created a static/geoposition/geoposition.js ( STATIC_ROOT defined as static under project root ), with the alternate content I wanted. All works fine in local dev server.

But, when I run python manage.py collectstatic, the original one is copied over. I kind of understand why that would be. Now, the question is, how do I override this js file that comes with the app and use my own in its place? Unfortunately, this uses a widget and defines its Media files there rather than from a template, which I could have easily overridden and used my js content with a different name.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • Use a different name for your `.js` or replace the original one or try to manipulate the order - https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#collectstatic – dmg Feb 23 '13 at 19:12

1 Answers1

2

You can easily extend this widget and override its media with your static files:

class MyGeoWidget(GeoPositionWidget):
     class Media:
         extend = False
         css = {
               'all': ('whatever.css',)
            }
         js = ('mygeoposition.js',)
almalki
  • 4,595
  • 26
  • 30