Passing parent with multiple childs from View to HTML

2009-09-26 Thread PlanetUnknown
I have been studying the modalforms & inline formsets but am not able to wrap my head around my composite objects, and want to see how things are done in django world - I have this hierarchical model "Author" has many "Books" Each "Book" has 4 Sections -> Section-01, Section-02, Section-03 & Se

Re: dJango updating fields which are not being set

2009-09-22 Thread PlanetUnknown
ok at the whole scenario, there are thousand consumers doing this, and each has one extra DB call. That's pretty expensive. On Sep 22, 11:41 am, Tom Evans wrote: > On Tue, 2009-09-22 at 08:13 -0700, PlanetUnknown wrote: > > I'm sure I'm missing something simple here, since

dJango updating fields which are not being set

2009-09-22 Thread PlanetUnknown
I'm sure I'm missing something simple here, since its a common flow - 1.) e.g. model Person - has 4 fields - person_id = models.AutoField(primary_key=True) person_name = models.CharField(max_length=50) comments = models.TextField(blank=True) create_dt = models.DateTimeField(auto_n

Re: How to define a "has-a" relationship in dJango models

2009-09-17 Thread PlanetUnknown
Thanks All. Thanks Javier. That makes sense, I'm implementing it via a OneToOe relationship now. On Sep 17, 4:38 am, Tom Evans wrote: > On Wed, 2009-09-16 at 17:15 -0500, Javier Guerra wrote: > > On Wed, Sep 16, 2009 at 1:01 PM, PlanetUnknown > > wrote: > > >

Re: How to define a "has-a" relationship in dJango models

2009-09-16 Thread PlanetUnknown
:52 am, Karen Tracey wrote: > On Wed, Sep 16, 2009 at 10:15 AM, PlanetUnknown > wrote: > > > > > For example - User HAS "Contacts"; User HAS "Preferences" > > Usually (I'm from an Oracle/Java background) the Contacts table would > > have a &

Re: How to define a "has-a" relationship in dJango models

2009-09-16 Thread PlanetUnknown
The OneToOne relationship seems to be more of an inheritance type of relationship, hence that cannot be used. On Sep 16, 10:28 am, Craig McClanahan wrote: > On Wed, Sep 16, 2009 at 7:15 AM, PlanetUnknown > > wrote: > > > For example - User HAS "Contacts"; User H

How to define a "has-a" relationship in dJango models

2009-09-16 Thread PlanetUnknown
For example - User HAS "Contacts"; User HAS "Preferences" Usually (I'm from an Oracle/Java background) the Contacts table would have a "user-id" foreign key. However Django models refer Foreign Key relations as "Many-to-one", but that is not true in my case. There is only one Contact table for a U

Re: Getting fields in a user profile

2009-09-15 Thread PlanetUnknown
is within []. Which means that it has returned a > list. > > Try this: > > >>> g1[0].get_modify_dt > > On Tue, Sep 15, 2009 at 8:23 PM, PlanetUnknown > wrote: > > > > > > > I could get the user profile object like below, but when I try to

Re: Getting fields in a user profile

2009-09-15 Thread PlanetUnknown
ects.filter(user=c1) >>> g1 [] >>> g1.modify_dt Traceback (most recent call last): File "", line 1, in AttributeError: 'QuerySet' object has no attribute 'modify_dt' On Sep 15, 6:49 pm, PlanetUnknown wrote: > Hello All, >         I recently exte

Getting fields in a user profile

2009-09-15 Thread PlanetUnknown
Hello All, I recently extended my User, with a User profile called GenericUserProfile, and it has a many-to-many field called farms (code below). Now all I want to do was add a "farm" to this farms field in the GenericUserProfile. But when I try doing that using the django python shell I

Re: Using custom table instead of "user" in django

2009-08-17 Thread PlanetUnknown
t; > Whole code: > > http://www.ojii.ch/auth.tar.gz > > If you wanna use it: > > Add the folder in the archive to your pythonpath. > > Add 'auth' to your installed applications > > Set 'USER_MODEL' in your settings file to the model you use (strin

Using custom table instead of "user" in django

2009-08-17 Thread PlanetUnknown
Guys, I have a quick question. I am attracted to django due to its flexibility however there is something bothering me now. My question is can I use a custom table, say "consumer" instead of the one provided my django ? Here are the reasons - 1.) I have my whole DB model around this consum