Thanks for the link, Derek. It's good to know that Django is integrating more JS into the admin - although I'm using 1.1.1, not 1.2. Hopefully customizing the admin with JQuery will make its way into the core documentation, as well.
On Mar 1, 12:31 am, derek <[email protected]> wrote: > Before you give up hope ;) you should read > this:http://djangoadvent.com/1.2/jquery-admin/ > > In the meanwhile, yes, there are a ton of good blog entries out there > on how to extend the admin with javascript (usually jQuery). When I > am feeling more organised, I will try and post some links here... > > On Feb 26, 8:39 pm, snfctech <[email protected]> wrote: > > > Thanks for the encouragement, Timothy. I haven't given up, but I'm > > scratching my head, and puzzled by why I have to look at people's blog > > posts to figure out how to use javascript/AJAXwith Django. It may be > > that I disagree with Django's philosophy that the framework should not > > be coupled with JS. > > > On Feb 26, 10:34 am, Timothy Kinney <[email protected]> wrote: > > > > Django was definitely designed to be extended. But it is sometimes hard to > > > find the write ways to extend what you specifically want. Don't give up on > > > extending admin. Hopefully someone will point you in the write direction. > > > > On Fri, Feb 26, 2010 at 11:06 AM, snfctech <[email protected]> > > > wrote: > > > > (Disclamor: I am new to Python/Django. Used to PHP/MVC ways of doing > > > > things.) > > > > > I want to customize the admin view, because it already does >50% of > > > > what I want for my application. > > > > > So, do I... > > > > > 1. Alter the HTML sent to the template? > > > > > One of the first things I want to do is add anAJAXonclick record > > > > detail display below the built-in change_list view. So, I started by > > > > thinking I need to add an onclick attribute or at least a <tr> id to > > > > the HTML that is rendered for the result_list block in the change_list > > > > template. This got me sniffing around django.contrib.admin.views.main > > > > and other files and I soon felt like I was barking up the wrong tree. > > > > > 2. Traverse the DOM on domready? > > > > > Then SmileyChris on #django suggested I add JS to traverse the DOM in > > > > order to add my onclick attribute. So I thought, okay, now I need to > > > > learn the right way to write javascript for Django. So I entered the > > > > keyword "javascript" in the Django documentation search field, and the > > > > results were not very satisfying. Then I checked djangobook.com and > > > > found a tiny section called "Custom JavaScript" in chapter 17. I > > > > thought, "great, I'll just window.addEvent('domready', function() > > > > { var changelist = document.getElementById('changelist')}); and go > > > > from there." But, no dice. No 'changelist' node on domready. I > > > > don't get it. > > > > > So I spent the rest of the day googling and banging my head trying to > > > > figure out how Django deals with Javascript. The best I found were > > > > some links to random blogs like: > > > > >http://lethain.com/entry/2008/sep/21/intro-to-unintrusive-javascript-... > > > > . > > > > But I kept searching because I thought learning how to work with > > > > javascript/AJAXin Django must certainly be in the core documentation > > > > somewhere, not in a random blog. Am I missing something? > > > > > So, is the right way to extend and admin view withAJAXone of the > > > > above methods I mentioned? > > > > > Is the authoritative Django documentation for how to work with > > > > javascript/AJAXa blog like > > > >http://lethain.com/entry/2008/sep/21/intro-to-unintrusive-javascript-... > > > > ? > > > > > Am I already going down the wrong path because, even though the admin > > > > code does >50% of what I want my app to do, I should not be > > > > customizing the admin code to build my app. > > > > > Thanks in advance for any tips. > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups > > > > "Django users" group. > > > > To post to this group, send email to [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]<django-users%[email protected]> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

