Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Commit

Permalink
Add user admin
Browse files Browse the repository at this point in the history
  • Loading branch information
avilaton committed Jun 21, 2018
1 parent 74e84dd commit 7450a10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
def register_admin_views(admin):

# admin views
from .views import MyModelView
from .views import MyModelView, UserModelView
from app.models import Agency
from app.models import Calendar
from app.models import CalendarDate
Expand All @@ -13,6 +13,7 @@ def register_admin_views(admin):
from app.models import Stop
from app.models import StopTime
from app.models import ShapePath
from app.models import User
from app import db


Expand All @@ -23,3 +24,4 @@ def register_admin_views(admin):
admin.add_view(MyModelView(Route, db.session))
admin.add_view(MyModelView(Trip, db.session))
admin.add_view(MyModelView(Stop, db.session))
admin.add_view(UserModelView(User, db.session))
5 changes: 5 additions & 0 deletions app/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def inaccessible_callback(self, name, **kwargs):
return current_app.login_manager.unauthorized()


class UserModelView(MyModelView):
excluded_list_columns = ['password_hash']
excluded_form_columns = ['password_hash']


# Create customized index view class that handles login & registration
class MyAdminIndexView(AdminIndexView):

Expand Down

0 comments on commit 7450a10

Please sign in to comment.