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 those libs on the list).

For filling this subcategory field, in terms of data transmission, i
use JSon, because JQuery has a fine JSon parser, in few lines it's all
done.

[]s,
Diego Ucha


On May 2, 6:05 am, martyn <[EMAIL PROTECTED]> wrote:
> 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 = models.DecimalField(max_digits=30, decimal_places=2)
>         famille = models.ForeignKey('Famille')
>         sous_categorie = models.ForeignKey('SousCategorie')
>         clic
>
>     class Admin:
>         pass
>
> I've got also Category and SubCategory :
>
> class Categorie(models.Model):
>         nom = models.CharField(maxlength=200)
>         slug = models.SlugField(prepopulate_from=('nom',))
>     class Admin:
>         pass
>
>     def __str__(self):
>         return self.nom
>
> class SousCategorie(models.Model):
>         nom = models.CharField(maxlength=200)
>         slug = models.SlugField(prepopulate_from=('nom',))
>         categorie = models.ForeignKey('Categorie')
>     class Admin:
>         pass
>
>     def __str__(self):
>         return self.nom
>
> Is there a way in django admin, in the Product form, to select the
> category, then the subcategories of this category only are shown in
> the select list.
>
> Thanks a lot
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to