mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
Merge pull request #1551 from getredash/change_tracking
Fix: flask-admin - exclude created_at/updated_at so models can be saved
This commit is contained in:
commit
4b4758af22
@ -42,6 +42,7 @@ class JSONTextAreaField(fields.TextAreaField):
|
||||
class BaseModelView(ModelView):
|
||||
column_display_pk = True
|
||||
model_form_converter = AdminModelConverter
|
||||
form_excluded_columns = ('created_at', 'updated_at')
|
||||
|
||||
@require_super_admin
|
||||
def is_accessible(self):
|
||||
@ -54,10 +55,13 @@ class QueryResultModelView(BaseModelView):
|
||||
|
||||
class QueryModelView(BaseModelView):
|
||||
column_exclude_list = ('latest_query_data',)
|
||||
form_excluded_columns = ('version', 'visualizations', 'alerts', 'org', 'created_at', 'updated_at', 'latest_query_data')
|
||||
|
||||
|
||||
class DashboardModelView(BaseModelView):
|
||||
column_searchable_list = ('name', 'slug')
|
||||
column_exclude_list = ('version', )
|
||||
form_excluded_columns = ('version', 'widgets', 'org', 'created_at', 'updated_at')
|
||||
|
||||
|
||||
def init_admin(app):
|
||||
|
@ -236,6 +236,9 @@ class Organization(TimestampMixin, db.Model):
|
||||
def __repr__(self):
|
||||
return u"<Organization: {}, {}>".format(self.id, self.name)
|
||||
|
||||
def __unicode__(self):
|
||||
return u'%s (%s)' % (self.name, self.id)
|
||||
|
||||
@classmethod
|
||||
def get_by_slug(cls, slug):
|
||||
return cls.query.filter(cls.slug == slug).first()
|
||||
|
Loading…
Reference in New Issue
Block a user