35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime, Text, ForeignKey, Index, TIMESTAMP
|
|
from sqlalchemy.orm import relationship, validates
|
|
|
|
from datetime import datetime
|
|
from src.database import Base,db_session
|
|
from marshmallow import Schema, fields, post_load, ValidationError
|
|
from src import clogger
|
|
import json
|
|
import flask
|
|
from src.models import Section
|
|
import re
|
|
|
|
def validate_image(k, img):
|
|
return True
|
|
class FullOrganizationtypeSchema(Schema):
|
|
id = fields.Integer()
|
|
name = fields.String()
|
|
image = fields.String()
|
|
updated_at = fields.DateTime()
|
|
created_at = fields.DateTime()
|
|
|
|
class Organizationtype(Base):
|
|
__tablename__ = 'organizationtypes'
|
|
name=Column(String(250), unique=True, nullable=False)
|
|
organizations=relationship("Organization", back_populates="organizationtype")
|
|
image=Column(String(250))
|
|
|
|
__schema__= FullOrganizationtypeSchema
|
|
__whiteattrs__= ["url", "name", "image"]
|
|
__jsonattrs__=None # None means all
|
|
|
|
def __init__(self, data={}):
|
|
self.update(data,False)
|
|
|