[Mayan EDMS: 1986] Adding Dashboard Widget

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1986] Adding Dashboard Widget

LeVon Smoker
I have a custom app (hrcsb_overrides) where I have am keeping my customizations to Mayan. I added the below code to try to add a widget to the home page as a shortcut to Cabinets (also to experiment).
        Cabinet = self.get_model('Cabinet')

       
DashboardWidget(
            icon
='fa fa-folder',
            queryset
=Cabinet.objects.all(),
            label
=_('Cabinets'),
            link
=reverse_lazy('cabinets:cabinet_list')
       
)

The call to get_model generates an error
LookupError: App 'hrcsb_overrides' doesn't have a 'Cabinet' model.


which I understand but I can't figure my way around this. Maybe I'm in the wrong place...

Thanks,
LeVon Smoker

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1987] Re: Adding Dashboard Widget

LeVon Smoker
I got this to work by removing the queryset parameter.

Now I'm wondering how to *remove* specific widgets...

LeVon S.

On Wednesday, August 9, 2017 at 1:39:36 PM UTC-4, LeVon Smoker wrote:
I have a custom app (hrcsb_overrides) where I have am keeping my customizations to Mayan. I added the below code to try to add a widget to the home page as a shortcut to Cabinets (also to experiment).
        Cabinet = self.get_model('Cabinet')

       
DashboardWidget(
            icon
='fa fa-folder',
            queryset
=Cabinet.objects.all(),
            label
=_('Cabinets'),
            link
=reverse_lazy('cabinets:cabinet_list')
       
)

The call to get_model generates an error
LookupError: App 'hrcsb_overrides' doesn't have a 'Cabinet' model.


which I understand but I can't figure my way around this. Maybe I'm in the wrong place...

Thanks,
LeVon Smoker

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1990] Re: Adding Dashboard Widget

rosarior
Administrator
Merged a branch I was working on to add support for unlimited dashboards. This branch also has support for removing widgets from a dashboard.


The dashboard widgets are now in a module called dashboard_widgets.py in each app. The dashboards are in a module called dashboards.py.
By default on the common app has a dashboard called `dashboard_main`.

For example to remove the "Total documents" dashboard widget use in any app apps.py file:

from common.dashboads import dashboard_main 
from documents.dashboard_widgets import widget_total_documents

dashboard_main.remove_widget(widget=widget_total_documents)

This has been merged and will be available in the next release.


On Wednesday, August 9, 2017 at 2:48:52 PM UTC-4, LeVon Smoker wrote:
I got this to work by removing the queryset parameter.

Now I'm wondering how to *remove* specific widgets...

LeVon S.

On Wednesday, August 9, 2017 at 1:39:36 PM UTC-4, LeVon Smoker wrote:
I have a custom app (hrcsb_overrides) where I have am keeping my customizations to Mayan. I added the below code to try to add a widget to the home page as a shortcut to Cabinets (also to experiment).
        Cabinet = self.get_model('Cabinet')

       
DashboardWidget(
            icon
='fa fa-folder',
            queryset
=Cabinet.objects.all(),
            label
=_('Cabinets'),
            link
=reverse_lazy('cabinets:cabinet_list')
       
)

The call to get_model generates an error
LookupError: App 'hrcsb_overrides' doesn't have a 'Cabinet' model.


which I understand but I can't figure my way around this. Maybe I'm in the wrong place...

Thanks,
LeVon Smoker

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1991] Re: Adding Dashboard Widget

LeVon Smoker
In reply to this post by LeVon Smoker
This is awesome. Thanks for the quick responses.

On Wednesday, August 9, 2017 at 1:39:36 PM UTC-4, LeVon Smoker wrote:
I have a custom app (hrcsb_overrides) where I have am keeping my customizations to Mayan. I added the below code to try to add a widget to the home page as a shortcut to Cabinets (also to experiment).
        Cabinet = self.get_model('Cabinet')

       
DashboardWidget(
            icon
='fa fa-folder',
            queryset
=Cabinet.objects.all(),
            label
=_('Cabinets'),
            link
=reverse_lazy('cabinets:cabinet_list')
       
)

The call to get_model generates an error
LookupError: App 'hrcsb_overrides' doesn't have a 'Cabinet' model.


which I understand but I can't figure my way around this. Maybe I'm in the wrong place...

Thanks,
LeVon Smoker

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.