On 6/24/06, Timothy Murphy <tim at birdsnest.maths.tcd.ie> wrote:
> On Saturday 24 June 2006 19:16, Robert Synnott wrote:
>> > > > > Does anyone have a nice simple program in python
> > > > > which gives a graphical page for inputting an inventory,
> > > > > with about 12 "columns" for each item?
>> > Well, mod_python and a couple of loops would do it quite nicely, if a
> > web-based thing is acceptable.
>> More than acceptable, if you could show me how to do it ...
>> Or an example of a program doing something similar.
>> --
> Timothy Murphy
> e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
> tel: +353-86-2336090, +353-1-2842366
> s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
>http://modpython.org
Very crude example, off the top of my head, you could make a form with:
columns = ('id', 'name'....)
for i in range(row_count):
req.write('<tr>')
for j in columns:
req.write("<td><input type='text' name='%s%d'/></td>" % (j, i))
req.write('</tr>')
Then to put it in db:
(build query string, maybe using columns
fsc = req.getFieldSomething #can't remember function name
for i in range(row_count):
row = []
for j in columns:
row.append(fsc.get("%s%d" % (j,i))
db.execute(querystring, row)
Very, very rough and ready, but something along those lines should do the job.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!