Why can' t you use the already pre-defined id field? You don't need to
define a new one, every table already has and and id field with name
"id".
Fabiano.
On Sat, Jan 15, 2011 at 6:37 AM, Rick wrote:
> So the problem was that the controller file line creates an error when
> I
> add the 'id' f
Virtual Fields do not help you here because they are computed when
records are extracted not when stored. virtual fields are not stored
at all.
The 'input' table already has an auto-increment id field. You cannot
gave two autoincrement ids. It is bad design and would slow the
database a lot.
You
So the problem was that the controller file line creates an error when
I
add the 'id' field and 'migrate=False' to the day table. Here is some
more code:
===in the model file===
import datetime
now = datetime.date.today()
db.define_table('day',
Field('the_id', 'id'),
Field('thedate
Could you shows us the relevant part of your models file, where the
table is defined and then also the error ticket.
Kenneth
Thanks for the suggestion! The 'id' field looks like a smart solution.
But there seem to be a problem -- This line creates an error when I
add the 'id' field and 'migra
Thanks for the suggestion! The 'id' field looks like a smart solution.
But there seem to be a problem -- This line creates an error when I
add the 'id' field and 'migrate=False' to the day table:
records = db().select(db.day.ALL, orderby=db.day.thedate)
Any ideas?
On Jan 4, 4:03 am, Fabiano wrot
What stops you from using 'id' field?
Unfortunately the code bellow seems to be errors-prone:
==in a model file==
class MyVirtualFields(object):
def input_number(self):
return some_variable
db.input.virtualfields.append(MyVirtualFields())
>On Jan 3, 8:03 pm, Rick wrote:
> Perhaps this would be a good idea to
Perhaps this would be a good idea to keep track of the records:
==in a model file==
n = 0
class MyVirtualFields():
def day_number(self):
n=n+1
return n
but I'm not sure about how to write this idea properly in python.
Perhaps there should be some kind of lo
Thanks for the replies. Now I try to add the ability to delete
records, but it doesn't seem to work:
db(db.input.virtualfields==session.virtualfields).delete()
>On Jan 3, 1:52 pm, Bruno Rocha wrote:
> [ Copy Paste Mystake ]
>
> Correct is:
>
> you have two options:
>
> 1. define the virtual fiel
[ Copy Paste Mystake ]
Correct is:
you have two options:
1. define the virtual fields in model
=in a model file==
db.define_table('input',
Field('value', 'integer'))
class MyVirtualFields(object):
def input_number(self):
return self.input.value
db.input.virtualfiel
Almost right, the problem is that you are appending 'MyVirtualFields' to the
Table after the Rows have been fetched.
you have two options:
1. define the virtuak fields in model
=in a model file==
db.define_table('input',
Field('value', 'integer'))
class MyVirtualFields(object):
def
Thanks for the advice. I changed my code, but I don't know if I'm on
the right track. Anyhow it doesn't work.
==in a model file==
db.define_table('input',
Field('value', 'integer'))
class MyVirtualFields(object):
def input_number(self):
return self.input.value
==in
12 matches
Mail list logo