Code Monkey home page Code Monkey logo

Comments (2)

mrjoes avatar mrjoes commented on May 12, 2024

Probably I don't understand question right...

Administrative interface is built on top of python classes. If you inherit from existing class, you're inheriting its functionality. So, for example, if you create something like this:

class MyAdmin(ModelAdmin):
    list_columns = ('test', 'foo')

it will be still sqlalchemy adminstrative class. Its just sqlalchemy admin implementation knows that it should look for list_columns in self and work accoridingly.

As for passing customization parameters through the constructor, do something like this::

class MyView(ModelView):
    def __init__(self, model, session, name=None, category=None, list_columns=None, rename_columns=None, ...)
        self.list_columns = list_columns
        self.rename_columns = rename_columns

        super(MyView, self).__init__(model, session, name, category)

And then just use your class::

admin.add_view(MyView(User, db.session, list_columns=('test','foo'))

from flask-admin.

Auha avatar Auha commented on May 12, 2024

Hmmm I think I asked a bad question. For some strange reason my brain was thinking that you coudl only inherit from the BaseModelView class.

from flask-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.