Prechádzať zdrojové kódy

Add initials customizing

Denis K 9 rokov pred
rodič
commit
30eebc407c

+ 12 - 0
jet/dashboard_modules/google_analytics.py

@@ -301,6 +301,10 @@ class GoogleAnalyticsVisitorsTotals(GoogleAnalyticsBase):
     title = _('Google Analytics visitors totals')
     template = 'jet/dashboard/modules/google_analytics_visitors_totals.html'
 
+    def __init__(self, title=None, period=None, **kwargs):
+        kwargs.update({'period': period})
+        super(YandexMetrikaVisitorsTotals, self).__init__(title, **kwargs)
+
     def init_with_context(self, context):
         result = self.api_ga()
 
@@ -321,6 +325,10 @@ class GoogleAnalyticsVisitorsChart(GoogleAnalyticsBase):
     group = None
     settings_form = GoogleAnalyticsChartSettingsForm
 
+    def __init__(self, title=None, period=None, show=None, group=None, **kwargs):
+        kwargs.update({'period': period, 'show': show, 'group': group})
+        super(GoogleAnalyticsVisitorsChart, self).__init__(title, **kwargs)
+
     def settings_dict(self):
         settings = super(GoogleAnalyticsVisitorsChart, self).settings_dict()
         settings['show'] = self.show
@@ -358,6 +366,10 @@ class GoogleAnalyticsPeriodVisitors(GoogleAnalyticsBase):
     contrast = False
     settings_form = GoogleAnalyticsPeriodVisitorsSettingsForm
 
+    def __init__(self, title=None, period=None, group=None, **kwargs):
+        kwargs.update({'period': period, 'group': group})
+        super(GoogleAnalyticsPeriodVisitors, self).__init__(title, **kwargs)
+
     def settings_dict(self):
         settings = super(GoogleAnalyticsPeriodVisitors, self).settings_dict()
         settings['group'] = self.group

+ 12 - 4
jet/dashboard_modules/yandex_metrika.py

@@ -162,10 +162,6 @@ class YandexMetrikaBase(DashboardModule):
     class Media:
         js = ('jet/vendor/chart.js/Chart.min.js', 'jet/modules/yandex_metrika.js')
 
-    def __init__(self, title=None, period=None, **kwargs):
-        kwargs.update({'period': period})
-        super(YandexMetrikaBase, self).__init__(title, **kwargs)
-
     def settings_dict(self):
         return {
             'period': self.period,
@@ -240,6 +236,10 @@ class YandexMetrikaVisitorsTotals(YandexMetrikaBase):
     title = _('Yandex Metrika visitors totals')
     template = 'jet/dashboard/modules/yandex_metrika_visitors_totals.html'
 
+    def __init__(self, title=None, period=None, **kwargs):
+        kwargs.update({'period': period})
+        super(YandexMetrikaVisitorsTotals, self).__init__(title, **kwargs)
+
     def init_with_context(self, context):
         result = self.api_stat_traffic_summary()
 
@@ -260,6 +260,10 @@ class YandexMetrikaVisitorsChart(YandexMetrikaBase):
     group = None
     settings_form = YandexMetrikaChartSettingsForm
 
+    def __init__(self, title=None, period=None, show=None, group=None, **kwargs):
+        kwargs.update({'period': period, 'show': show, 'group': group})
+        super(YandexMetrikaVisitorsChart, self).__init__(title, **kwargs)
+
     def settings_dict(self):
         settings = super(YandexMetrikaVisitorsChart, self).settings_dict()
         settings['show'] = self.show
@@ -291,6 +295,10 @@ class YandexMetrikaPeriodVisitors(YandexMetrikaBase):
     contrast = False
     settings_form = YandexMetrikaPeriodVisitorsSettingsForm
 
+    def __init__(self, title=None, period=None, group=None, **kwargs):
+        kwargs.update({'period': period, 'group': group})
+        super(YandexMetrikaPeriodVisitors, self).__init__(title, **kwargs)
+
     def settings_dict(self):
         settings = super(YandexMetrikaPeriodVisitors, self).settings_dict()
         settings['group'] = self.group