old_contents: # -*- coding: utf-8 -*-
  
  import logging
  
  from pyramid.i18n import TranslationStringFactory
  
  from c2cgeoportal.models import *  # noqa
  from pyramid.security import Allow, ALL_PERMISSIONS
  from formalchemy import Column
  from sqlalchemy import ForeignKey
  from sqlalchemy.types import Integer, Boolean, Unicode
  from c2cgeoportal.models import AUTHORIZED_ROLE, _schema
  
  _ = TranslationStringFactory('geoportailv3')
  log = logging.getLogger(__name__)
  
  
  class LuxLayerInternalWMS(LayerInternalWMS):
      __label__ = _(u'Internal WMS layer')
      __plural__ = _(u'Internal WMS layers')
      __tablename__ = 'lux_layer_internal_wms'
      __table_args__ = {'schema': _schema}
      __acl__ = [
          (Allow, AUTHORIZED_ROLE, ALL_PERMISSIONS),
      ]
      __mapper_args__ = {'polymorphic_identity': 'lu_int_wms'}
  
      id = Column(
          Integer,
          ForeignKey(_schema + '.layer_internal_wms.id'),
          primary_key=True
      )
      url = Column(Unicode, label=_(u'Url'))
      layers = Column(Unicode, label=_(u'Layers'))
  
  
  class LuxLayerExternalWMS(LayerExternalWMS):
      __label__ = _(u'External WMS layer')
      __plural__ = _(u'External WMS layers')
      __tablename__ = 'lux_layer_external_wms'
      __table_args__ = {'schema': _schema}
      __acl__ = [
          (Allow, AUTHORIZED_ROLE, ALL_PERMISSIONS),
      ]
      __mapper_args__ = {'polymorphic_identity': 'lu_ext_wms'}
  
      id = Column(
          Integer,
          ForeignKey(_schema + '.layer_external_wms.id'),
          primary_key=True
      )
      category_id = Column(Integer, label=_(u'Category ID'))
      is_poi = Column(Boolean, label=_(u'Is a POI'))
      collection_id = Column(Integer, label=_(u'Collection ID'))
  
  
  class LuxRoleTheme(Base):
      __label__ = _(u'LuxRoleTheme')
      __plural__ = _(u'LuxRoleTheme')
      __tablename__ = 'lux_role_theme'
      __table_args__ = {'schema': _schema}
      __acl__ = [
          (Allow, AUTHORIZED_ROLE, ALL_PERMISSIONS),
      ]
  
      theme_id = Column(
          Integer,
          ForeignKey(_schema + '.theme.id'),
          primary_key=True
      )
      role_id = Column(
          Integer,
          label=_(u'Role ID'),
          primary_key=True
      )
  
new_contents: # -*- coding: utf-8 -*-
  
  import logging
  
  from pyramid.i18n import TranslationStringFactory
  
  from c2cgeoportal.models import *  # noqa
  from pyramid.security import Allow, ALL_PERMISSIONS
  from formalchemy import Column
  from sqlalchemy import ForeignKey, Table
  from sqlalchemy.types import Integer, Boolean, Unicode
  from c2cgeoportal.models import AUTHORIZED_ROLE, _schema
  
  _ = TranslationStringFactory('geoportailv3')
  log = logging.getLogger(__name__)
  
  
  class LuxLayerInternalWMS(LayerInternalWMS):
      __label__ = _(u'Internal WMS layer')
      __plural__ = _(u'Internal WMS layers')
      __tablename__ = 'lux_layer_internal_wms'
      __table_args__ = {'schema': _schema}
      __acl__ = [
          (Allow, AUTHORIZED_ROLE, ALL_PERMISSIONS),
      ]
      __mapper_args__ = {'polymorphic_identity': 'lu_int_wms'}
  
      id = Column(
          Integer,
          ForeignKey(_schema + '.layer_internal_wms.id'),
          primary_key=True
      )
      url = Column(Unicode, label=_(u'Url'))
      layers = Column(Unicode, label=_(u'Layers'))
  
  
  class LuxLayerExternalWMS(LayerExternalWMS):
      __label__ = _(u'External WMS layer')
      __plural__ = _(u'External WMS layers')
      __tablename__ = 'lux_layer_external_wms'
      __table_args__ = {'schema': _schema}
      __acl__ = [
          (Allow, AUTHORIZED_ROLE, ALL_PERMISSIONS),
      ]
      __mapper_args__ = {'polymorphic_identity': 'lu_ext_wms'}
  
      id = Column(
          Integer,
          ForeignKey(_schema + '.layer_external_wms.id'),
          primary_key=True
      )
      category_id = Column(Integer, label=_(u'Category ID'))
      is_poi = Column(Boolean, label=_(u'Is a POI'))
      collection_id = Column(Integer, label=_(u'Collection ID'))
  
  # association table role <> Theme
  lux_role_theme = Table(
      'lux_role_theme', Base.metadata,
      Column(
          'theme_id', Integer,
          ForeignKey(_schema + '.theme.id'), primary_key=True
      ),
      Column(
          'functionality_id', Integer,
          ForeignKey(_schema + '.role.id'), primary_key=True
      ),
      schema=_schema
  )
  
subject: Use Table instead of a Class for the association between role and theme