<s> from flask import Markup <EOL> import datetime <EOL> import math <EOL> from sqlalchemy import Column , Integer , String , ForeignKey , Date , Float , Numeric <EOL> from sqlalchemy . orm import relationship <EOL> from flask_appbuilder . models . mixins import AuditMixin , BaseMixin , FileColumn , ImageColumn <EOL> from flask_appbuilder import Model <EOL> from flask_appbuilder . models . decorators import renders <EOL> mindate = datetime . date ( datetime . MINYEAR , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> class ContactGroup ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT:50> ) , unique = True , nullable = False ) <EOL> def extra_col ( self ) : <EOL> return "<STR_LIT>" . format ( self . id ) <EOL> @ renders ( '<STR_LIT:name>' ) <EOL> def extra_col2 ( self ) : <EOL> return Markup ( "<STR_LIT>" + self . name + "<STR_LIT>" ) <EOL> def __repr__ ( self ) : <EOL> return self . name <EOL> class ProductManufacturer ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT:50> ) , unique = True , nullable = False ) <EOL> def __repr__ ( self ) : <EOL> return self . name <EOL> class ProductModel ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT:50> ) , unique = True , nullable = False ) <EOL> product_manufacturer_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> product_manufacturer = relationship ( "<STR_LIT>" ) <EOL> def __repr__ ( self ) : <EOL> return self . name <EOL> class Product ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT:50> ) , unique = True , nullable = False ) <EOL> product_manufacturer_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> product_manufacturer = relationship ( "<STR_LIT>" ) <EOL> product_model_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> product_model = relationship ( "<STR_LIT>" ) <EOL> def __repr__ ( self ) : <EOL> return self . name <EOL> class Gender ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT:50> ) , unique = True , nullable = False ) <EOL> def __repr__ ( self ) : <EOL> return self . name <EOL> def test ( ) : <EOL> return math . pi - <NUM_LIT:1.0> <EOL> class FloatModel ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> value = Column ( Float , nullable = False , default = test ) <EOL> value_numeric = Column ( Numeric , nullable = False , default = test ) <EOL> def __repr__ ( self ) : <EOL> return self . value <EOL> class Contact ( Model ) : <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT> ) , unique = True , nullable = False ) <EOL> address = Column ( String ( <NUM_LIT> ) ) <EOL> birthday = Column ( Date , nullable = True ) <EOL> personal_phone = Column ( String ( <NUM_LIT:20> ) ) <EOL> personal_celphone = Column ( String ( <NUM_LIT:20> ) ) <EOL> contact_group_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> contact_group = relationship ( "<STR_LIT>" ) <EOL> gender_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> gender = relationship ( "<STR_LIT>" ) <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % ( self . name , self . contact_group ) <EOL> def month_year ( self ) : <EOL> date = self . birthday or mindate <EOL> return datetime . datetime ( date . year , date . month , <NUM_LIT:1> ) or mindate <EOL> def year ( self ) : <EOL> date = self . birthday or mindate <EOL> return datetime . datetime ( date . year , <NUM_LIT:1> , <NUM_LIT:1> ) </s>
