Re: Admin : Select category -> show subcategory

2008-05-21 Thread martyn
Stupid me, yes you're absolutly right. It could be something like this $(document).ready(function(){ changeMySelect(); # ... and select my subcategorie too. } $("select#id_categorie").change(function(){ changeMySelect(); } function changeMySelect(){ ...do something to change my s

Re: Admin : Select category -> show subcategory

2008-05-20 Thread Diego Ucha
Ok Martyn, understood. Mainly that piece of code represents many functions, one inside the other, since you need to reuse one, than you could declare this inner function that you are aiming at, outside the event and call it on the event(s) (in your case onchange and document ready). That way you w

Re: Admin : Select category -> show subcategory

2008-05-20 Thread martyn
In fact, at the creation, you select a category, the the subcategories are shown. It's OK /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*- ===Create_Object=== Category [--select_category--] SubCategory [--select_subcategory--] /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*- But, at the modificatio

Re: Admin : Select category -> show subcategory

2008-05-20 Thread martyn
In fact, at the creation, you select a category, the the subcategories are shown. It's OK But, a On 18 mai, 01:22, Diego Ucha <[EMAIL PROTECTED]> wrote: > You need to set a Subcategory as default when this field is loaded by > the field Category? > Sorry Martyn, i didn't get your doubt, could y

Re: Admin : Select category -> show subcategory

2008-05-17 Thread Diego Ucha
You need to set a Subcategory as default when this field is loaded by the field Category? Sorry Martyn, i didn't get your doubt, could you elaborate more? On May 13, 2:23 am, martyn <[EMAIL PROTECTED]> wrote: > It's true, I don't know for what reason I changed this before posting, > but I've seen

Re: Admin : Select category -> show subcategory

2008-05-12 Thread martyn
It's true, I don't know for what reason I changed this before posting, but I've seen the error to, correct it and, no way. But I made a error on my urls, this /admin/boutique/produit/getsubcategory/ was not the same as urls.py, so I had no response. Now I've got another question. I've never used

Re: Admin : Select category -> show subcategory

2008-05-08 Thread Diego Ucha
You're welcome, Martyn. You changed the argument of this nested function and didn't change the reference to it in the subsequent code: function(d){ What about replacing it for: function(j){ Your code would look like that: http://127.0.0.1/django-medias/chantier/js/ jquery-1.2.3.js" type="t

Re: Admin : Select category -> show subcategory

2008-05-08 Thread martyn
The Javascript Function does not seem to be executed. In admin_form.html : {% extends "admin/change_form.html" %} {% block extrahead %} http://127.0.0.1/django-medias/chantier/js/ jquery-1.2.3.js" type="text/javascript"> $(function(){ $("select#id_categorie").change(function(){ $.get

Re: Admin : Select category -> show subcategory

2008-05-08 Thread martyn
That's it ! I'm discovering JQuery, not very "sexy" for the first time, but seems to be really powerfull. Thank you Diego. Django community really rocks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Admin : Select category -> show subcategory

2008-05-05 Thread Diego Ucha
First of all, I recommend that you read chapter 17 of Django Book (if you haven't already) http://www.djangobook.com/en/1.0/chapter17/ Moving on, you have to create a view, as we are working on Django's admin, then i recommend that you create one like project/app/ admin_views.py with something si

Re: Admin : Select category -> show subcategory

2008-05-04 Thread martyn
Thank you, it's just what I wanted, but do I have to write a new template (admin/model_name/etc...) ? Or can I define this directly in my model (onchange actions...) ? I have the django Book (definitive guide to django) but I can't find this. On 4 mai, 02:26, Diego Ucha <[EMAIL PROTECTED]> wro

Re: Admin : Select category -> show subcategory

2008-05-03 Thread Diego Ucha
Hello Martyn, The main interaction, that i see you need is: (On Product form) User select Category -> Subcategory field is auto- filled -> User select a subcategory based on the category selected. Then you will have to use some JS Library (I prefer JQuery, besides there are some discussion about

Admin : Select category -> show subcategory

2008-05-02 Thread martyn
Hi, I've created a simple product model : class Produit(models.Model): nom = models.CharField(maxlength=200) slug = models.SlugField(prepopulate_from=('nom',)) description = models.TextField(blank=True) published = models.BooleanField(default=True) prix_ht