P
P
pcdesign2016-01-11 10:25:33
Flask
pcdesign, 2016-01-11 10:25:33

How to make different inserts in Sqlalchemy depending on the user type?

I am rewriting one project.
And there is such a situation.
Users insert data into the table like this:

insert into hange (date,person,from_cur,from_sum,to_cur,to_sum,comment) values (now(),?,?,?,?,?,?)


And the admins are like this:

insert into hange (date,person,from_cur,from_sum,to_cur,to_sum,course,fee_cur,fee,fee_percent,comment) values (?,?,?,?,?,?,?,?,?,?,?)


That is, admins insert more data than ordinary users.

The question is what to do with __init__ in the model description?

class Hange(db.Model):
    # Таблицы и поля. 
    
    def __init__ # Вот каким он должен быть?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question