示例#1
0
 def init_defaults(self):
     Api.init_defaults(self)
     self.model_class = False
     self.lookup_class = False
     self.form_class = False
     self.primary_key = False
     self.model_instance = False
     self.lookup_instance = False
     self.access_module = None
     self.access_model = None
示例#2
0
 def init_defaults(self):
     Api.init_defaults(self)
     self.model_class = False
     self.lookup_class = False
     self.form_class = False
     self.primary_key = False
     self.model_instance = False
     self.lookup_instance = False
     self.access_module = None
     self.access_model = None
示例#3
0
 def init_defaults(self):
     Api.init_defaults(self)
     self.model = None
     self.date_field = None
     self.date_range = None
     self.start_date = None
     self.stop_date = None
     self.group_by = 'month'
     self.aggregate_field = None
     self.aggregate_function = 'count'
     self.extra = {}
     self.values = []
     self.order_by = ['-year']
示例#4
0
 def init_defaults(self):
     Api.init_defaults(self)
     self.model = None
     self.date_field = None
     self.date_range = None
     self.start_date = None
     self.stop_date = None
     self.group_by = 'month'
     self.aggregate_field = None
     self.aggregate_function = 'count'
     self.extra = {}
     self.values = []
     self.order_by = ['-year']
示例#5
0
    def init_defaults(self):
        Api.init_defaults(self)
        self.access = None
        self.model = None
        self.model_class = None
        self.stats_class = None
        self.stats_instance = None

        self.entity_class = None
        self.entity_query_set = None
        self.entity_query_set = None
        self.entity_values = []
        self.entity_excludes = {}
        self.entity_legend_prefix = ""
        self.entity_legend_map_field = ""
        self.entity_format = ""
        self.entity_formatters = []
示例#6
0
    def init(self):
        #Create the lookup class
        if self.lookup_class:
            self.lookup_instance = self.lookup_class(
                params=self.front_controller.request_parser.params)
            self.lookup_instance.front_controller = self.front_controller

        #Create the access based on the access_module and access_model
        """
        access = {
            "*": {
                "access": "admin"
            },
            "create_action": {
                "access": "article.add_article"
            },
            "read_action": {
                "access": "article.view_article"
            },
            "update_action": {
                "access": "article.change_article"
            },
            "delete_action": {
                "access": "article.delete_article"
            },
        }
        """
        if self.access is not None and self.access_module is not None and self.access_model is not None:
            action_permission_map = {
                'create': 'add',
                'read': 'view',
                'update': 'change',
                'delete': 'delete'
            }
            actions = ['create', 'read', 'update', 'delete']
            for action in actions:
                action_key = "{0}_action".format(action)
                if action_key in self.access:
                    continue
                self.access.update({
                    action_key: {
                        "access":
                        "{0}.{1}_{2}".format(self.access_module,
                                             action_permission_map[action],
                                             self.access_model)
                    }
                })

        #call the parent
        return Api.init(self)
示例#7
0
 def init(self):
     #Create the lookup class
     if self.lookup_class:
         self.lookup_instance = self.lookup_class(params=self.front_controller.request_parser.params)
         self.lookup_instance.front_controller = self.front_controller
         
     #Create the access based on the access_module and access_model
     """
     access = {
         "*": {
             "access": "admin"
         },
         "create_action": {
             "access": "article.add_article"
         },
         "read_action": {
             "access": "article.view_article"
         },
         "update_action": {
             "access": "article.change_article"
         },
         "delete_action": {
             "access": "article.delete_article"
         },
     }
     """
     if self.access is not None and self.access_module is not None and self.access_model is not None:
         action_permission_map = {
             'create': 'add',
             'read': 'view',
             'update': 'change',
             'delete': 'delete'
         }
         actions = ['create', 'read', 'update', 'delete']
         for action in actions:
             action_key = "{0}_action".format(action)
             if action_key in self.access:
                 continue
             self.access.update({
                 action_key: {
                     "access": "{0}.{1}_{2}".format(self.access_module, action_permission_map[action], self.access_model)
                 }
             })
         
     #call the parent
     return Api.init(self)