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/AJAX with 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 <timothyjkin...@gmail.com> 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 <tschm...@sacfoodcoop.com> 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 an AJAX onclick 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/AJAX in 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 with AJAX one of the
> > above methods I mentioned?
>
> > Is the authoritative Django documentation for how to work with
> > javascript/AJAX a 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 django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> > .
> > 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 django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to