def generate_update_view(self): """Generate class based view for UpdateView""" name = model_class_form(self.model + 'UpdateView') update_args = dict( form_class=self.get_actual_form('update'), model=self.get_model_class, template_name=self.get_template('update'), permissions=self.view_permission('update'), permission_required=self.check_permission_required, login_required=self.check_login_required, inlineformset=self.inlineformset, custom_form=self.createupdate_forms or self.custom_modelform, success_url=reverse_lazy('{}-{}-list'.format(self.app, self.custom_postfix_url)), custom_postfix_url=self.custom_postfix_url ) parent_classes = [self.get_createupdate_mixin(), UpdateView] if self.custom_update_view_mixin: parent_classes.insert(0, self.custom_update_view_mixin) update_class = type( name, tuple(parent_classes), update_args ) self.classes[name] = update_class return update_class
def generate_create_view(self): """Generate class based view for CreateView""" name = model_class_form(self.model + 'CreateView') create_args = dict(form_class=self.get_actual_form('create'), model=self.get_model_class, template_name=self.get_template('create'), permissions=self.view_permission('create'), permission_required=self.check_permission_required, login_required=self.check_login_required, inlineformset=self.inlineformset, success_url=reverse_lazy('{}-{}-list'.format( self.app, self.custom_postfix_url)), custom_form=self.createupdate_forms or self.custom_modelform, custom_postfix_url=self.custom_postfix_url) parent_classes = [self.get_createupdate_mixin(), CreateView] if self.custom_create_view_mixin: parent_classes.insert(0, self.custom_create_view_mixin) create_class = type(name, tuple(parent_classes), create_args) self.classes[name] = create_class return create_class
def generate_delete_view(self): """Generate class based view for DeleteView""" name = model_class_form(self.model + 'DeleteView') delete_args = dict(model=self.get_model_class, template_name=self.get_template('delete'), permissions=self.view_permission('delete'), permission_required=self.check_permission_required, login_required=self.check_login_required, success_url=reverse_lazy('{}-{}-list'.format( self.app, self.custom_postfix_url)), custom_postfix_url=self.custom_postfix_url) delete_class = type(name, (CrudBuilderMixin, DeleteView), delete_args) self.classes[name] = delete_class return delete_class
def generate_delete_view(self): """Generate class based view for DeleteView""" name = model_class_form(self.model + 'DeleteView') delete_args = dict( model=self.get_model_class, template_name=self.get_template('delete'), permissions=self.view_permission('delete'), permission_required=self.check_permission_required, login_required=self.check_login_required, success_url=reverse_lazy('{}-{}-list'.format(self.app, self.custom_postfix_url)), custom_postfix_url=self.custom_postfix_url ) delete_class = type(name, (CrudBuilderMixin, DeleteView), delete_args) self.classes[name] = delete_class return delete_class
def generate_update_view(self): """Generate class based view for UpdateView""" name = model_class_form(self.model + 'UpdateView') update_args = dict(form_class=self.get_actual_form('update'), model=self.get_model_class, template_name=self.get_template('update'), permissions=self.view_permission('update'), permission_required=self.check_permission_required, login_required=self.check_login_required, inlineformset=self.inlineformset, custom_form=self.createupdate_forms or self.custom_modelform, success_url=reverse_lazy('{}-{}-list'.format( self.app, self.custom_postfix_url)), custom_postfix_url=self.custom_postfix_url) update_class = type(name, (self.get_createupdate_mixin(), UpdateView), update_args) self.classes[name] = update_class return update_class