Reputation: 4354
I have to override certain js and py files in django. I could override the templates but what should I do about the js and py files. I can see that the django admin has included html tags like
right in the py files. Is this the right practice? They should have used some sort of templates rather than including tags like
right in the py files. Also how am I supposed to override the js files at the whole application level?
Upvotes: 1
Views: 1380
Reputation: 24921
About changing the .py files, I have no idea. But you could add and/or overwrite some javascript functionality doing something like:
from django.contrib import admin
from settings import MEDIA_URL
from myshop.models import MyModel
class MyModelAdmin(admin.ModelAdmin):
# inlines, fields, filter or anything else you want to add
class Media:
js = (MEDIA_URL + 'js/jquery.js',
MEDIA_URL + 'js/my_own_javascript.js')
admin.site.register(MyModel, MyModelAdmin)
Upvotes: 1