Re: Dynamic menus using ul and li

2007-06-28 Thread Chris Moffitt
A while back when I was trying to do a similar thing, someone mentioned
using elementree to do this.  I tried a bunch of other ways but in the end,
elementree was the easiest way for me.  If you'd like to see the template
tag I created, you can see it here -
http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/templatetags/category_display.py

Hopefully this will point you in the right direction.

-Chris

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Dynamic menus using ul and li

2007-06-28 Thread FrostedDark

What I need is a way to create nested menus using  and  with
the data coming from a model.  I need to be able to get the entire
list:


Home
Some Category

Page

Even Deeper
Another Deeper Page


Another Page


Some Other Page


But also be able to pull a sub tree and tell it how deep to go:


Page
Another Page


Here is a sample of the model for the data...
class Page(models.Model):
title = models.CharField(maxlength=200)
slug = models.SlugField(prepopulate_from = ['name'])
parent = models.ForeignKey('self', blank=True, null=True)
content = models.TextField()
active = models.BooleanField(default = True)
show_in_menu = models.BooleanField(default = True)

I have spent the past week or so trying to figure this out and just
cant quite figure out how to do it... any help at all would be greatly
appreciated.  And for the record, Django ROCKS!!

Eric


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic Menus...

2006-08-25 Thread Jonathan Buchanan

> And (obviously?) dont rely on the correct make and model coming back
> from your form. You'll eventually get someone constructing their own
> POST data for a laugh and seeing what happens if they had selected
> Renault Impala... :)

Here's example source for an implementation of just that in Django:

http://tinyurl.com/f8zq8

This implementation loads all the possible values for child selects
instead of making a new request every time a selection is made in the
parent, and uses the following script on the client side to display
the new items:
http://www.jonathanbuchanan.plus.com/repos/js-utils/10-selectupdater.html

If you want a script which can make a request every time you select a
value which it doesn't already have child select data for, you might
be interested in this one instead (NB: the demo form is not live):
http://www.jonathanbuchanan.plus.com/repos/js-utils/01-selectloader.html

Jonathan.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Dynamic Menus...

2006-08-25 Thread spacedman

And (obviously?) dont rely on the correct make and model coming back
from your form. You'll eventually get someone constructing their own
POST data for a laugh and seeing what happens if they had selected
Renault Impala... :)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Dynamic Menus...

2006-08-24 Thread Sean

Not really django related, but here goes:

It depends on how you want to implement the form.

1. Using javascript and implementing a dynamic option list. You can find
enough examples on dynamicdrive.com and other sites

2. Using Javascript an ajax you could hook into the onchange event of
the first drop down list and fire off a xmlhttprequest to populate the
second select list.

3. Or the static way:  Select brand -> submit form -> display new form
that lists the available models.

mediumgrade wrote:
> Don't know if this is a Django question or not, but here is the
> situation:
>
> I am developing an application for a client who is a automobile broker.
> He wants agents to submit requests for vehicles from the web. The agent
> will be able to select the make/model of the vehicle. What I want is
> for the model menus to adjust dynamically depending on the make
> selected. For example, if the agent selects "Honda" I only the the
> models menu to show Civic, Accord, Element, ect.
>
> How can this be achieved?
>
>
> >
>
>   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Dynamic Menus...

2006-08-24 Thread Josh Trutwin

On Thu, 24 Aug 2006 19:13:11 -
"mediumgrade" <[EMAIL PROTECTED]> wrote:

> 
> Don't know if this is a Django question or not, but here is the
> situation:
> 
> I am developing an application for a client who is a automobile
> broker. He wants agents to submit requests for vehicles from the
> web. The agent will be able to select the make/model of the
> vehicle. What I want is for the model menus to adjust dynamically
> depending on the make selected. For example, if the agent selects
> "Honda" I only the the models menu to show Civic, Accord,
> Element, ect.
> 
> How can this be achieved?

I had to do this same exact thing - it's pretty easy to do with
dojo.

http://code.djangoproject.com/wiki/AJAX

Josh

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Dynamic Menus...

2006-08-24 Thread Chris Long

Using javascript would be the way to go. Though you have two options on
how to know which car relates to which manufacturer.

1) AJAX: Query the server, which will return a list to be placed in the
select field.
2) Hard coded JS: Hard code it into a JS array that will then be used
to look up the fields and put it into the select box. If you go this
route, you can put the JS into 

Dynamic Menus...

2006-08-24 Thread mediumgrade

Don't know if this is a Django question or not, but here is the
situation:

I am developing an application for a client who is a automobile broker.
He wants agents to submit requests for vehicles from the web. The agent
will be able to select the make/model of the vehicle. What I want is
for the model menus to adjust dynamically depending on the make
selected. For example, if the agent selects "Honda" I only the the
models menu to show Civic, Accord, Element, ect.

How can this be achieved?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---