Awesome thanks... But then that removes the need for a Category... : ( The projects have to be linked to the Specs which are only linked to the Category of the Project.
class ProjectSpecs(models.Models): Project=models.ForeignKey(Project) Specs=models.ForeignKey(Specs, ##Limit by Category of the Project## ) Values=models.CharField(max_length=200) You think I should write a customized function for that? I think that may be the answer!!! What do you guys think is it better to have more models, less columns or less models, more columns??? Which is more efficient in the long term? On Dec 10, 11:26 am, GRoby <gregory.r...@gmail.com> wrote: > It sounds like you just need a ProjectSpecs Table: > > class ProjectSpecs(models.Models): > Project=models.ForeignKey(Project) > Specs=models.ForeignKey(Specs) > Values=models.CharField(max_length=200) > > That would let you assign as many specs to a project that you want, > with additional fields (basically a many to many relation). > > On Dec 10, 10:57 am, Superman <ramseydsi...@gmail.com> wrote: > > > By the way this is what the three models roughly look like. > > > Class Projects(model.Models): > > title = models.CharField(max_length=200) > > category = models.ForeignKey(Category) > > > Class Category(model.Models): > > title = models.CharField(max_length=200) > > specs = models.ManyToManyField(Specs) > > > Class Specs(model.Models): > > title = models.CharField(max_length=200) > > > On Dec 10, 10:53 am, Superman <ramseydsi...@gmail.com> wrote: > > > > Thank you DR for your response. > > > > Yes that helps in a way, as that is what I am planning to do. But at > > > the moment I can store the name of Projects, Categories and Specs in > > > the three different models. Where can I store the values for the Specs > > > for each Project? There is no table that contains that information. > > > How can I set that table up... in a way that it can expand both > > > sideways and downwards? > > > > On Dec 10, 10:38 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > > > > > On Dec 10, 3:19 pm, Superman <ramseydsi...@gmail.com> wrote: > > > > > > Hi guys, I can't wrap my head around this problem I have... someone > > > > > please help. > > > > > > The Problem: I have a list of various projects, in a Project Model. > > > > > Each of them has a foreign Key to a Category model. Each Category has > > > > > a Many to Many Relationship to a Specification model. So it is like > > > > > this. Project ---> Category --->(m2m) Specifications. All these tables > > > > > are going to change/increment. I want to set up a table with column 1 > > > > > as Project, column 2 as Category and the rest of the columns as > > > > > Specification. > > > > > > For ex. these are possibly two rows from the column: > > > > > Colum -> Row1 > > > > > Project -> Skyrise Appartments > > > > > Category -> Residential Building > > > > > Specification -> Height - 100m > > > > > -> Floors - 30f > > > > > -> Cost - 50m > > > > > -> Start - Dec 2009 > > > > > -> Finish - Dec 2010 > > > > > ->Rest of the columns blank > > > > > > Colum -> Row 2 > > > > > Project -> GreatHarbour Bridge > > > > > Category -> Bridge > > > > > Specification -> Length - 1 km > > > > > -> Type - Cable Stayed > > > > > -> Speed - 80 km/hr > > > > > -> Pillars - 200 > > > > > -> Cost - 20m > > > > > -> Start - Feb 2010 > > > > > -> Finish - Nov 2010 > > > > > >Rest of the columns blank > > > > > > I dont want to ceate individal tables for Each Category... coz I may > > > > > have Hundreds of Categories, Projects and Specs. How do I go about > > > > > doing this? Please help... > > > > > > Thanks > > > > > I don't understand what you mean when you say you want to "set up a > > > > table" with those various columns. The columns all exist in separate > > > > tables. What would be the benefit of putting them into a single table? > > > > > Do you just mean you want to output the columns from various tables at > > > > once? You can easily do that with Django's ORM, which is capable of > > > > traversing the relationships between tables. You can then use the > > > > template language to group the fields into columns for output. Does > > > > that help? > > > > -- > > > > DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.