Hi all, I have a group of employees and a set of skills. One employee can have many skills and one skill can be had by many employees. What I want to do is to represent the skills of all employees in one table, where the score of each employee in each skill is given on a scale from 0 to 5 like:
------------------------------------------------
Name | UNIX | Apache | Python |
------------------------------------------------
AT | 4 | 3 | 4 |
------------------------------------------------
MO | 5 | 3 | 4 |
------------------------------------------------
MF | 4 | 3 | 3 |
------------------------------------------------
Model:
----------
db.define_table('online_team',
Field('first_name', notnull=True),
Field('last_name', notnull=True),
Field('email', requires=IS_EMAIL(), notnull=True, unique=True),
Field('initials', notnull=True, unique=True))
## format='%(first_name, last_name)s')
db.define_table('skills',
Field('skill', notnull=True, unique=True))
db.define_table('ownership',
Field('initials', 'reference online_team'),
Field('skill', 'reference skills'))
Now, in my controller I have a function to add records to the ownership
table (combining both skills and employees) and view these records on the
fly (supposedly the table I drew above without the scores):
def view_matrix():
# create an insert form from the table
form = SQLFORM(db.ownership).process()
# if form correct perform the insert
if form.accepted:
response.flash = 'New skills added to team member. '
my_rows =
SQLTABLE(db().select(db.ownership.ALL),headers='fieldname:capitalize')
return dict(form=form, rows=my_rows)
The problem is that whatever I insert into the form of ownership table, I
get something like the attached screen, no real initials, no real skills
despite skills table and employees table are there and filled with sample
data. I have the feeling I am doing something wrong in the model /
controller.
Your help is much appreciated. Thanks in advance.
All the best,
Angie Tawfik
--
---
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.
<<attachment: skills.png>>

