#
#   Python backend and Angular frontend code generation by gencrud
#   Copyright (C) 2018-2021 Marc Bertens-Nguyen m.bertens@pe2mbs.nl
#
#   This library is free software; you can redistribute it and/or modify
#   it under the terms of the GNU Library General Public License GPL-2.0-only
#   as published by the Free Software Foundation.
#
#   This library is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   Library General Public License for more details.
#
#   You should have received a copy of the GNU Library General Public
#   License GPL-2.0-only along with this library; if not, write to the
#   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
#   Boston, MA 02110-1301 USA
#
#   gencrud: 2021-04-04 08:26:09 version 2.1.680 by user mbertens
#
import webapp2.api as API
from webapp2.common.dbmem import DbBaseMemory
from webapp2.common.crudmixin import CrudModelMixin




class News( API.db.Model, CrudModelMixin ):
    """Model for the news table, this is generated by the gencrud.py module
    When modifing the file make sure that you remove the table from the configuration.
    """
    __field_list__       = ['N_ID', 'N_MESSAGE', 'N_ACTIVE', 'N_ALERT', 'N_KEEP', 'N_START_DATE', 'N_END_DATE', 'N_REMARK']
    __tablename__        = 'news'
    N_ID                 = API.db.Column( "n_id", API.db.Integer, autoincrement = True, primary_key = True )
    N_MESSAGE            = API.db.Column( "n_message", API.db.String( 255 ), nullable = False )
    N_ACTIVE             = API.db.Column( "n_active", API.db.Boolean, default = False )
    N_ALERT              = API.db.Column( "n_alert", API.db.Boolean, default = False )
    N_KEEP               = API.db.Column( "n_keep", API.db.Boolean, default = False )
    N_START_DATE         = API.db.Column( "n_start_date", API.db.Date, nullable = False )
    N_END_DATE           = API.db.Column( "n_end_date", API.db.Date, nullable = True )
    N_REMARK             = API.db.Column( "n_remark", API.db.LONGTEXT, nullable = True )


    def memoryInstance( self ):
        return NewsMemory( self )


API.dbtables.register( News )


class NewsMemory( DbBaseMemory ):
    __model_cls__       = News
    __tablename__       = 'news'


API.memorytables.register( NewsMemory )
