sacrud/pyramid_sacrud

Using a backref hides/overrides the primary key

hyperknot opened this issue · 2 comments

If there is a backref relationship defined on a children, the following is happening to the parent:

  1. The primary key's field disappears from the web UI.
  2. The backref's created field appears, and it takes the place of the primary key.
  3. Even specifying with sacrud_list_col = ['slug'], doesn't display the slug field, but the backref created field.
class Parent(Base):
    __tablename__ = 'parents'

    slug = Column(Unicode, primary_key=True)
    name = Column(Unicode, nullable=False)

class Child(Base):
    __tablename__ = 'children'

    provider_slug = Column(Unicode, ForeignKey('parents.slug'), primary_key=True)
    slug = Column(Unicode, primary_key=True)

    provider = relationship('Parent', backref=backref('children'))

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Version 0.1.5 of sacrud_deform will solve this problem. Just update it pip install -U sacrud_deform. Please check it out and let me know that your problem solved or not.

Hi, I've migrated to a custom admin interface so unfortunately I cannot test out this solution.