Malcolm,
Ok, I've modified my models.py with the following code
class sdetails(models.Model):
color = models.ForeignKey(color)
size = models.ForeignKey(size)
price = models.ForeignKey(price)
class style(models.Model):
name = models.CharField(maxlength=100)
styleslug = models.SlugField(prepopulate_from=["name"])
image = models.ImageField(upload_to='site_media/')
collection_id = models.ForeignKey(collection)
styledetails = models.ManyToManyField(sdetails,
edit_inline=models.TABULAR, num_in_admin=3)
However, I now get an error becuase I guess I can't use edit_inline in
a ManyToManyField. Any suggestions?
On May 20, 12:36 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-05-20 at 10:03 -0700, Greg wrote:
> > Hello,
> > I am trying to create a Django website where I sell area rugs. I'm
> > starting the process of creating the structure of my site, but am
> > having problems creating my admin correctly. Each area rug that I
> > sell has a list of sizes (with a price associated with each size). I
> > can't seem to figure out how I'm going to setup my admin page that
> > add's an area rug. This page is going to need to be able to add
> > multiple sizes and associated each size with a price.
>
> > Here is a snaphot of my admin page when i add a style
> >http://www.plushrugs.com/image.jpg. As you can see I don't have it
> > setup to where I can associate a size with a price. All I can do is
> > select multiple sizes and multiple prices.
>
> > You can also take a look at my models file at the following url -
> >http://www.plushrugs.com/model.txt
>
> The problem isn't in the admin interface setup, so much as in your model
> design. As you noticed in the admin interface, there is no
> correspondence between a prices, colors and sizes, but this difficulty
> extends to the model level. A "style" contains a bunch of those items,
> without tying them together into triplets.
>
> I would suggest that you make a new model which holds a particular
> combination of price, color and size and then the "style" class has a
> many-to-many field pointing to this other model. Then you can use
> edit_inline to create new price/color/size combinations when you are
> creating a style.
>
> Regards,
> Malcolm- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---