syrusakbary/Flask-SuperAdmin

Question about changing field type (and default)

vburca opened this issue · 2 comments

Hello,

I have a field that I want to be of type TextArea (in the db it is stored as Unicode string) and that will accept whitespace (basically like a raw text field where I can put new lines and such).

I've been looking around for a while and I can't see to figure it out, sorry...

Also, for a 'created_at' field, I would like to give it a default value so that I don't have to always fill it in. I added this:

class ProjectsModel(model.ModelAdmin):
  session = db.session
  field_args = { 
                  'created_at': { 'default': datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") }
               }

but it doesn't seem to do anything...

Thank you,
Vlad

you can fix that at db level.

db.DateTimeField(default=datetime.datetime.utcnow())

👍

hehe

Thank you though! :)