index.html:
{{extend 'layout.html'}}
<h2>All projects:</h2>
<br/>
{{for item in items: }}
{{=item[3]}}
{{pass}}
def_index:
items = db.executesql('SELECT * FROM project;')
return locals()
model:
db.define_table('company',
Field('company_name', notnull=True, unique=True),
Field('email'),
Field('phone', notnull=True),
Field('url'),
format = '%(company_name)s')
db.company.email.requires=IS_EMAIL()
db.company.url.requires=IS_EMPTY_OR(IS_URL())
db.define_table('project',
Field('name', notnull=True),
Field('employee_name', db.auth_user,
default=auth.user_id),
Field('company_name', 'reference company', notnull=True),
Field('description', 'text', notnull=True),
Field('start_date', 'date', notnull=True),
Field('due_date', 'date', notnull=True),
Field('completed', 'boolean', notnull=True),
format = '%(company_name)s')
db.project.employee_name.readable = True
db.project.employee_name.writable = False
db.project.start_date.requires = IS_DATE(format=T('%m-%d-%Y'),
error_message='Must be MM-DD-YYYY!')
db.project.due_date.requires = IS_DATE(format=T('%m-%d-%Y'),
error_message='Must be MM-DD-YYYY!')
On Sunday, September 1, 2013 2:56:47 AM UTC+3, Massimo Di Pierro wrote:
>
> I need to see more code.
>
> On Saturday, 31 August 2013 16:25:32 UTC-5, אבי אברמוביץ wrote:
>>
>> Hi,
>> I do this query:
>> items = db.executesql('SELECT * FROM project;')
>> For the field below, which is a field in the db.project:
>> Field('company_name', 'reference company', notnull=True).
>> On the view, "{{=item[3]}}" renders only '1'.(instead of the company
>> name).
>> What should I do?
>> Thanks.
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.