Re: Ajax TreeList with Django

2009-08-26 Thread Peter Herndon

On 08/26/2009 03:52 PM, Dirso wrote:
> I'd like to create a dynamic treelist (using Ajax, Django and
> Postgres). Did anyone know tutorial ou code piece that could do this
> magic?
>
>
Hi Dirso,

I've done something similar to what you are describing, using jQuery, 
the dynatree jQuery plugin, and some reasonable Django code.  The code 
is available at http://bitbucket.org/tpherndon/django-fedora/, and 
you'll specifically be interested in the djadora/views/browse.py and the 
djadora/templates/fedora/browse_dynatree.html and image_fragment.html files.

I implemented the code as part of a special-purpose web app for 
interfacing with a Java repository system, and the code is far from 
clean and pretty, but it should give you a decent example of something 
that is currently in production.

The way I approached it was to write a couple of views that are designed 
to handle the jQuery dynatree Ajax requests.  Dynatree does the work on 
building the tree in HTML, my views provide the data, and the models 
each have a "parent" attribute that allows the views to figure out how 
to select children for each tree level.

In retrospect, I'd do my best to reuse django-mptt, django-treebeard, or 
similar.  They aren't a direct fit for my use case, since I have 
different models that can contain each other, and from what I've seen 
they are geared to handle only a single model class pointing to itself, 
but I would follow their approach and steal code like crazy.  :)  Or, if 
I had just one kind of model, I'd just add enough Ajax views to power 
dynatree.

---Peter

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



Ajax TreeList with Django

2009-08-26 Thread Dirso

Hi,

I'd like to create a dynamic treelist (using Ajax, Django and
Postgres). Did anyone know tutorial ou code piece that could do this
magic?

Thanks,
Dirso
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---