X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/224a257ade788e1a87aab78032dc3cdc9677cc06..c03a740f65ea24ba6567b0ef75f3785faae37d42:/floof/model/users.py?ds=sidebyside diff --git a/floof/model/users.py b/floof/model/users.py index f51282c..0f05a52 100644 --- a/floof/model/users.py +++ b/floof/model/users.py @@ -1,19 +1,16 @@ -from sqlalchemy import Column, ForeignKey -from sqlalchemy.orm import relation -from sqlalchemy.types import Integer, Unicode +# +# floof/floof/model/users.py +# +# Copyright (c) 2009 Scribblr +# -from floof.model import meta +from elixir import Entity, Field, Unicode, belongs_to, has_many -__all__ = ['User', 'IdentityURL'] +class User(Entity): + name = Field(Unicode(20)) + has_many('identity_urls', of_kind='IdentityURL') -class User(meta.TableBase): - __tablename__ = 'users' - id = Column(Integer, primary_key=True) - name = Column(Unicode(length=20), nullable=False) +class IdentityURL(Entity): + url = Field(Unicode(255)) + belongs_to('user', of_kind='User') -class IdentityURL(meta.TableBase): - __tablename__ = 'identity_urls' - url = Column(Unicode(length=255), primary_key=True) - user_id = Column(Integer, ForeignKey('users.id')) - -IdentityURL.user = relation(User, lazy=False, backref="identity_urls")