# -*- coding: utf-8 -*-
from Lotus.app import db


class User(db.Model):
    userid = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(16), unique=True)
    avatar = db.Column(db.String(64), unique=True)
    description = db.Column(db.String(128), unique=True)
    type = db.Column(db.String(16))
    email = db.Column(db.String(32), unique=True)
    '''
    constant
    '''
    CONST_TYPE_USER = 'user'
    CONST_TYPE_ADMIN = 'admin'

    def __init__(self):
        self.userid = None
        self.nickname = None
        self.username = None
        self.avatar = None
        self.description = None
        self.type = None

    def __repr__(self):
        return '<User %r>' % self.username




@@ -208,29 +208,16 @@
 ring(64)
-, unique=True
 )%0A    de
@@ -252,29 +252,16 @@
 ing(128)
-, unique=True
 )%0A    ty
@@ -336,24 +336,59 @@
 nique=True)%0A
+    psw = db.Column(db.String(32))%0A
     '''%0A    
@@ -433,16 +433,16 @@
  'user'%0A
-
     CONS
@@ -463,16 +463,56 @@
  'admin'
+%0A    CONST_DEFAULT_PASSWORD = '12345678'
 %0A%0A    de

add psw and description should not be unique