Beispiel #1
0
 def fromModelModule(self, modelModule):
     modelClasses = [
         getattr(modelModule, moduleAttr) for moduleAttr in dir(modelModule)
     ]
     modelClasses = [
         mc for mc in modelClasses if hasattr(mc, 'NAME_PROPERTY')
     ]
     [
         self.addManagementInterface(djangoforms.autoForm(mc))
         for mc in modelClasses
     ]
     return self
Beispiel #2
0
    def getUrlHandlerTuples(self):
        modelClassName = self.modelClassName
        retTuples = [
            ("/%s/list" % modelClassName, self.ListPage),
            ("/%s/list/[0-9]*" % modelClassName, self.ListPage),
            ("/%s/table" % modelClassName, self.TablePage),
            ("/%s/save" % modelClassName, self.SaveHandler),
            ("/%s/viewprop" % modelClassName, self.ViewPropHandler),
            ("/%s/saveprop" % modelClassName, self.SavePropHandler),
            ("/%s/editprop" % modelClassName, self.EditPropHandler),
            ("/%s/delete" % modelClassName, self.DeleteHandler),
            ("/%s/edit" % modelClassName, self.EditPage),
            ("/%s/view" % modelClassName, self.ViewPage),
        ]

        # Add URLs for our referring classes of the form: /Model1/key/Model2/table
        for refProp in getattr(self.modelClass, "referringProperties", []):
            refClass = refProp.model_class
            refUrl = "/%s/.*/%s/table" % (modelClassName, refClass.__name__)
            refHandler = self.__class__(djangoforms.autoForm(refClass)).TablePage
            retTuples.append((refUrl, refHandler))
        return retTuples
Beispiel #3
0
    def getUrlHandlerTuples(self):
        modelClassName = self.modelClassName
        retTuples = \
            [   ('/%s/list' % modelClassName, self.ListPage ),
                ('/%s/list/[0-9]*' % modelClassName, self.ListPage ),
                ('/%s/table' % modelClassName, self.TablePage ),
                ('/%s/save' % modelClassName, self.SaveHandler ),
                ('/%s/viewprop' % modelClassName, self.ViewPropHandler ),
                ('/%s/saveprop' % modelClassName, self.SavePropHandler ),
                ('/%s/editprop' % modelClassName, self.EditPropHandler ),
                ('/%s/delete' % modelClassName, self.DeleteHandler ),
                ('/%s/edit' % modelClassName, self.EditPage ),
                ('/%s/view' % modelClassName, self.ViewPage ),
            ]

        # Add URLs for our referring classes of the form: /Model1/key/Model2/table
        for refProp in getattr(self.modelClass, 'referringProperties', []):
            refClass = refProp.model_class
            refUrl = '/%s/.*/%s/table' % (modelClassName, refClass.__name__)
            refHandler = self.__class__(
                djangoforms.autoForm(refClass)).TablePage
            retTuples.append((refUrl, refHandler))
        return retTuples
Beispiel #4
0
 def fromModelModule(self, modelModule):
     modelClasses = [getattr(modelModule, moduleAttr) for moduleAttr in dir(modelModule)]
     modelClasses = [mc for mc in modelClasses if hasattr(mc, "NAME_PROPERTY")]
     [self.addManagementInterface(djangoforms.autoForm(mc)) for mc in modelClasses]
     return self