DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Joseph Mancuso for Masonite

Posted on • Updated on

Masonite Python Framework - New Dashboard Package!

Introduction

I had an idea for a new Masonite package called Masonite Dashboard. This dashboard by itself is completely barebones and really only contains a welcome message but allows the ability to expand it using strictly Service Providers.

This means that any package you install has the ability to create it's own admin dashboard module. Maybe your next Stripe payment integration package contains a dashboard module to manage subscriptions or send out invoices right from the admin panel. Or maybe the next API package contains a dashboard module to monitor API usage.

That is what this new dashboard package does. You can read more about installing Masonite Dashboard but this documentation will be about how easy it is to expand it into a User Management system where you can:

  • See users
  • Add users
  • Search users
  • Delete users
  • Login as users (badass)

If you want to follow along then you'll have to read on how to install Masonite Dashboard here and come back to this article. If you want to just see how awesome it is then continue reading.

Once Masonite Dashboard is installed we saw a new dashboard like this:

Configuration

The configuration is very minor here. Once we have Masonite Dashboard installed and we have successfully logged in according to the documentation, we just need a few configuration steps for each add-on. We'll work on expanding the built in dashboard module here and add a user management system.

Service Provider

First we need to add a Service Provider to our PROVIDERS list in config/providers.py:

...
from dashboard.providers import UserManagementProvider
...

PROVIDERS = [
    ...
    DashboardProvider,
    UserManagementProvider,
]
Enter fullscreen mode Exit fullscreen mode

That's it for the Service Provider. Let's move on to adding some required routes to our app.

Routes

Just import the routes needed and add them to your ROUTES list.

from dashboard.routes import management_routes
...

ROUTES = [
    ...
    management_routes(),
    ...
]
Enter fullscreen mode Exit fullscreen mode

That's it! Now let's open our dashboard and we'll see a new navigation link:

If we click on the link we will be taken to the new module where we can add, delete and login as other users:

It's that simple!


If you want to contribute to the development of the package or interested in the development of Masonite then be sure to join the Slack channel or star the repo on GitHub. Thanks!

Top comments (0)

πŸ‘‹ Hey, my name is Noah and I’m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, I’d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: