Thanks Michal & other friends for sharing your time for this.

I gather from this thread that I need to write my own class for this.
It is a bit like manufacturing an axe myself before cutting the wood.
But, continuing the python philosophy, let me look at the briter side
of it.
If I write the class myself, I can cater to my needs exactly; no
problem of "unsupported/dead project; others can benefit from my work.

Cheers.

On Jul 14, 8:12 pm, Michal Petrucha <michal.petru...@ksp.sk> wrote:
> On Thu, Jul 14, 2011 at 07:20:12AM -0700, Hummingbird wrote:
> > Maybe, I didn't explain the condition properely.
>
> > As you say, in this case,
> > "UPDATE custdetl SET tel = NULL, address = <new address>, CITY = <new
> > city>
> > WHERE custid = <some ID>"
> > is fine in this simplified version.
>
> > Suppose when a user removes address, tel, city from table 'custdetl'.
> > When fields are not nullable (not null=true),
> > Then update won't do the job.
> > We NEED to delete the row.
>
> Maybe it is just me, but still, if the fields are not nullable, then
> the user cannot clear his phone number while keeping the rest of his
> info there -- either you delete his entire row or you keep something
> in each column. Either way, you won't be able to accomplish what you
> wrote in the previous e-mail.
>
> > Similarly regarding inserts.
> > If there is no row in 'custdetl' previously, then user interacts the
> > form & adds the details, then we NEED insert statement.
>
> This all depends on the primary key of the table -- if there is no row
> with the specified primary key, Django INSERTs one, otherwise it does
> an UPDATE.
>
> In your case I can imagine having custid as the primary key. That way,
> if you fill out a form for a customer whose details are not in the
> table, they get inserted; otherwise they are updated.
>
> > In actual project, I have individual forms handling as many as >10
> > linked tables.
> > I need to issue insert/update/delete statements to different tables.
> > Any idea how to go about it?
>
> This should be perfectly achievable using formsets. The Django admin
> implements this via a mechanism called "InlineAdmin" which is in fact
> just a bit of sugar around regular formsets.
>
> > (p.s. : If you want, I will post one elaborate example.)
>
> Dunno, that might help; from the one you supplied thus far it is
> really not clear what you want to accomplish.
>
> Michal
>
>  signature.asc
> < 1KViewDownload

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