pawamoy/django-suit-dashboard

Error in tutorial

Closed this issue · 2 comments

The layout example raises an error:

TypeError: All elements of Column must be Row or Box instances
# -*- coding: utf-8 -*-
# dashboard/views.py

from __future__ import unicode_literals
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from suit_dashboard.layout import Grid, Row, Column
from suit_dashboard.views import DashboardView
from suit_dashboard.box import Box

class HomeView(DashboardView):
    template_name = 'dashboard/main.html'
    crumbs = (
        {'url': 'admin:index', 'name': _('Home')},
    )
    grid = Grid(
      Row(
        Column(
          Box(title='Row 1 column 1 box 1'),
          Box(title='Row 1 column 1 box 2'),
          width=6),
        Column(
          Box(title='Row 1 column 2 box 1'),
          Box(title='Row 1 column 2 box 2'),
          width=6),
      ),
      Row(
        Column(
          Box(title='Row 2 column 1 box 1'),
          Box(title='Row 2 column 1 box 2'),
          width=3),
        Column(
          Box(title='Row 2 column 2 box 1'),
          Box(title='Row 2 column 2 box 2'),
          width=5),
        Column(
          Row(
            Column(
              Box(title='R2 C3 R1 C1 B1'),
              Box(title='R2 C3 R1 C1 B2'),
              width=12)
          ),
          Row(
            Column(
              Box(title='R2 C3 R2 C1 B1'),
              Box(title='R2 C3 R2 C1 B2'),
              width=12)
          ),
          width=4),
      )
    )

Hi, thanks again, there was an error in the code responsible for checking the type of the column elements. It has been pushed to master, soon to PyPi

Done !