Hi all,

I've got a fastdatagrid object and would like to work with only a
subset of the data. Currently, it lets everyone edit/view the entire
"events" table in the database. I would like it to only display the
events that belong to the logged in user. Some details:

from events.kid, this is how the data is displayed:

  ${list_widget.display(data, show_actions=True,
                        show_add_link=True,
                        delete_link_msg='Are you sure you want to
delete this event?',
                        add_link_title='Add Event')}

from controllers.py
    events = DataController(
            sql_class = Course,
            list_widget = FastDataGrid(fields=[
                ('Name', 'course_name'),
                ('Provider', 'user'),
                ('Course Type', 'course_type'),
                ('Maximum Participants', 'max_participants'),
                ('Date', 'date'),
                ('Venue', 'venue')
            ]),
            list_template = 'kco.templates.events')

and the class is defined in model.py:
class Course(SQLObject):
  user = ForeignKey('User')
  course_name = UnicodeCol(alternateID=True, length=255)
  course_type = ForeignKey('CourseType')
  max_participants = IntCol()
  date = DateTimeCol()
  venue = UnicodeCol(length=255)

I would have thought that the DataController knows some sort of query
argument, but it appears not so. One idea then was to implement this
on the SQLObject level by defining the statement inside the
DataController constructor sql_class = Course.select(user.q.$
{tg.identity.user.user_name}) but that doesn't work.

Does anyone know how this can be accomplished?

Cheers

- Balt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to