On Dec 10, 7: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?

Why do you need this stored as a table in the database?

Since the specs for a category could change - you want the specs for a
project to always be up to date.

You can get the specs for a project by querying through the category
object now.

Were you to contrive some table to store this, you'd have to make sure
to update it any time you changed a category.

What you want is  a project.specs() function that will do the lookup
for you as a convenience.

-Preston

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


Reply via email to