Example #1
0
    def handle(self, *args, **options):
        view = load_obj(args[0])

        chart = ExtChart()
        window = ExtWindow(as_class=True, name=view.__name__+"Window", items=chart)

        print window
Example #2
0
    def handle(self, *args, **options):

        """
        form_module, form_name = args[0].rsplit(".", 1)

        __import__(form_module)
        module = sys.modules[form_module]

        print "Loading form '%s' from '%s'" % (form_name, module.__file__)
        form = getattr(module, form_name)
        instance = form()
        """
        
        instance = load_obj(args[0])

        form_elements = list()

        for name, field in instance.fields.items():
            print name, field.label, dir(field), dir(field.widget), field.widget.input_type
            element = {'xtype': FIELDTYPES[field.widget.input_type], 'name': name}

            if field.label:
                element['label'] = field.label

            form_elements.append(element)

        print ExtForm(items=form_elements, title='Form Fields', width=340, bodyPadding=5)
Example #3
0
    def handle(self, *args, **options):
        view = load_obj(args[0])
        model = self._get_model(view)

        columns = self._get_columns(model)

        grid = ExtGrid(columns=columns)

        grid.params['store']['model'] = model.__name__
        grid.params['store']['proxy']['directFn'] = "%s.%s" % (view.__module__.replace(".views",""), view.__name__)
        #grid.params['title'] =

        title = model._meta.verbose_name_plural.capitalize() if hasattr(model._meta, "verbose_name_plural") else ""

        print unicode(ExtWindow(as_class=True, name=view.__name__+"Window", items=grid, title=title)).encode("utf-8") +\
            "\n\n" + unicode(convert(model)).encode("utf-8")
Example #4
0
    def handle(self, *args, **options):
        view = load_obj(args[0])
        model = view.model
        tpl = self._create_template(model)

        dataview = DataView(tpl=tpl)
        title = ""

        dataview.params['store']['model'] = model.__name__
        dataview.params['store']['proxy']['directFn'] = "%s.%s" % (view.__module__.replace(".views",""), view.__name__)

        print (
            unicode(ExtWindow(as_class=True, name=view.__name__+"Window", items=dataview, title=title)) +
            "\n\n" +
            unicode(convert(model))
        ).encode("utf-8")
Example #5
0
 def handle(self, *args, **options):
     instance = load_obj(args[0])
     print convert(instance)