Esempio n. 1
0
def ship_type_view(rec_id: int = None):
    data, headers, cap_headers = view_records(ShipType, rec_id)
    authenticated = current_user.is_authenticated
    return render_template('registry.html',
                           title='Ship Types',
                           data=data,
                           headers=headers,
                           cap_headers=cap_headers,
                           authenticated=authenticated,
                           model_name='ship_type')
Esempio n. 2
0
def engine_view(rec_id: int = None):
    data, headers, cap_headers = view_records(Engine, rec_id)
    authenticated = current_user.is_authenticated
    return render_template('registry.html',
                           title='Engines',
                           data=data,
                           headers=headers,
                           cap_headers=cap_headers,
                           authenticated=authenticated,
                           model_name='engine')
Esempio n. 3
0
def builder_view(rec_id: int = None):
    data, headers, cap_headers = view_records(Builder, rec_id)
    authenticated = current_user.is_authenticated
    return render_template('registry.html',
                           title='Builders',
                           data=data,
                           headers=headers,
                           cap_headers=cap_headers,
                           authenticated=authenticated,
                           model_name='builder')
Esempio n. 4
0
def users_view():
    authenticated = current_user.is_authenticated
    if authenticated:
        user = User.query.get(current_user.id)
        if user.is_admin:
            data, headers, cap_headers = view_records(User,
                                                      headers_override=[
                                                          'username',
                                                          'date_created',
                                                          'last_login',
                                                          'is_admin'
                                                      ])
            return render_template('registry.html',
                                   title='Users',
                                   data=data,
                                   headers=headers,
                                   user=current_user,
                                   cap_headers=cap_headers,
                                   authenticated=authenticated,
                                   model_name='users')
    return abort(403)