Hey guys,

I am currently working on a project for college and am trying to use
tgext.crud to create the admin interface. However I have a Enrolment model
that tgext.crud seems to be bugging out on.

class Enrolment(DeclarativeBase):
    __tablename__ = 'enrolment'
   student_id = Column('student_id', Integer,
ForeignKey('student.student_id'), primary_key=True)
   course_id = Column('course_id', Integer, ForeignKey('course.course_id'),
primary_key=True)

The /enrolment/ view table I have shows both columns as expected.

If I choose to edit one of the records it shows the student_id field as
disabled but allows editing of the course_id, this is fine by me.

However if I attempt to create a new record it shows *only* the course id.
This means that you are unable to enroll a student on a course as you
cannot enter a student id. If you create a record by just specifying a
course_id it will just set the student_id to 0 which you would be unable to
edit.

Here is my CrudRestController for this model:

class EnrolmentController(CrudRestController):
    model = model.Enrolment

    class new_form_type(AddRecordForm):
        __model__ = model.Enrolment
        __require_fields__ = ['student_id', 'course_id']
        __omit_fields__ = None

    class edit_form_type(EditableForm):
        __model__ = model.Enrolment

    class edit_filler_type(EditFormFiller):
        __model__ = model.Enrolment

    class table_type(TableBase):
        __model__ = model.Enrolment

    class table_filler_type(TableFiller):
        __model__ = model.Enrolment

Thanks for any help in advance,

Alan Jenkins

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


Reply via email to