I'm working on a site where I'll be selling area rugs online.   I will
have multiple manufacturers that contain multiple collections which
contain multiple styles which contain multiple sizes and prices.  I'm
wanting to develop my model structure so that when I add a collection
I can specify 10 (or so) different combinations of sizes and prices
for only that collection.  Each style from within the collection will
contain only a few of the default size and prices that I entered when
I added the collection.

So whenever I'm in the process of adding a style I want to be able to
specify the collection and then only that collections size and prices
and specified.  I can get it to where all the entries in the choices
field are shown.  However, I can't get it to where it only show's that
particular collection sizes and prices.  Would I need to include some
JavaScipt in my admin?

Here are how my models are currently setup.

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 Choice(models.Model):
    choice = models.ForeignKey(Collection, edit_inline=models.TABULAR,
num_in_admin=5)
    size = models.ForeignKey(Size, core=True)
    price = models.ForeignKey(Price, core=True)

    def __str__(self,):
        return str((self.size, self.price))

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

    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 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