projects
/
zzz-floof.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Switch over to Elixir
[zzz-floof.git]
/
floof
/
model
/
users.py
diff --git
a/floof/model/users.py
b/floof/model/users.py
index
f51282c
..
0f05a52
100644
(file)
--- 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")