示例#1
0
 def get_dashboard_blocks(self, request):
     if not self.check_demo_optin(request):
         return
     locale = get_current_babel_locale()
     n = now()
     weekday = format_date(n, "EEEE", locale=locale)
     today = format_date(n, locale=locale)
     yield DashboardValueBlock(
         id="test-x", color="blue", title="Happy %s!" % weekday, value=today, icon="fa fa-calendar"
     )
     yield DashboardNumberBlock(
         id="test-x", color="red", title="Visitors Yesterday", value=random.randint(2200, 10000), icon="fa fa-globe"
     )
     yield DashboardNumberBlock(id="test-x", color="gray", title="Registered Users", value=1240, icon="fa fa-user")
     yield DashboardNumberBlock(id="test-x", color="orange", title="Orders", value=32, icon="fa fa-inbox")
     yield DashboardMoneyBlock(
         id="test-x", color="green", title="Open Orders Value", value=32000, currency="USD", icon="fa fa-line-chart"
     )
     yield DashboardNumberBlock(id="test-x", color="yellow", title="Current Visitors", value=6, icon="fa fa-users")
     yield DashboardMoneyBlock(
         id="test-x", color="none", title="Sales this week", value=430.30, currency="USD", icon="fa fa-dollar"
     )
     yield DashboardValueBlock(
         id="test-1", value="\u03C0", title="The most delicious number", color="purple", icon="fa fa-smile-o"
     )
示例#2
0
 def get_dashboard_blocks(self, request):
     return [
         DashboardContentBlock(id="test-0", content="Hello",
                               size="invalid"),
         DashboardValueBlock(id="test-1", value="yes", title="hi"),
         DashboardNumberBlock(id="test-2", value=35, title="hello"),
         DashboardNumberBlock(id="test-3", value=35.3, title="hello"),
         DashboardMoneyBlock(id="test-4",
                             value=35,
                             title="hola",
                             currency="USD"),
     ]