I have three tables (Manufacturer, Collection, Style).  I have 10
manufacturers.  Each manufacturer contains approx. 20 collection.
Each collection contains approx. 20 Styles.  I was wondering if it's
possible when I'm adding styles I can select the manufacturer then my
collection (foreign key) field when drilled-down on shows only the
collections from the manufacturer I selected in the field above.  I'm
thinking that this might require some javascript.

Below are some of my tables

class Manufacturer(models.Model):
        name = models.CharField(maxlength=200)
        manufacturerslug = models.SlugField(prepopulate_from=["name"])
        description = models.TextField(maxlength=1000)

        def __str__(self,):
                return self.name

        class Admin:
                pass

class Collection(models.Model):
        name = models.CharField(maxlength=200)
        collectionslug = models.SlugField(prepopulate_from=["name"])
        description = models.TextField(maxlength=1000)
        manufacturer = models.ForeignKey(Manufacturer)

        def __str__(self,):
                return self.name

        class Admin:
                list_display = ('name', 'manufacturer')
                list_filter = ('manufacturer',)

class Style(models.Model):
    name = models.CharField(maxlength=200)
    theslug = models.SlugField(prepopulate_from=('name',))
    collection = models.ForeignKey(Collection)

    class Admin:
        search_fields = ['name']
        list_filter = ('collection',)
        list_display = ('name', 'theslug','collection', 'rmanu')

    def __str__(self,):
        return self.name

    def rmanu(self):
        return self.collection.manufacturer

Thanks for any help


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