Esempio n. 1
0
def delete(id):
    File = get_model('file')
    obj = File.get(int(id))

    def pre_delete(obj):
        fileserving = functions.get_fileserving('UPLOAD_TEST')
        fileserving.delete_filename(obj.filename)

    view = functions.DeleteView(File, obj=obj, ok_url='/list', pre_delete=pre_delete)
    return view.run()
Esempio n. 2
0
    def delete(self, id):
        def pre_delete(obj):
            pass
            
        obj = self.model.get_or_notfound(int(id))
        view = functions.DeleteView(self.model, 
            obj=obj,
#            pre_delete=pre_delete,
        )
        return view.run(json_result=True)
Esempio n. 3
0
 def delete(self, id):
     def pre_delete(obj):
         obj.class_obj.issue_num -= 1
         obj.class_obj.save()
         
     obj = self.model.get_or_notfound(int(id))
     view = functions.DeleteView(self.model, obj=obj,
         pre_delete=pre_delete,
     )
     return view.run(json_result=True)
Esempio n. 4
0
 def delete(self, id):
     def pre_delete(obj):
         pass
         
     obj = self.model.get_or_notfound(int(id))
     view = functions.DeleteView(self.model, 
         ok_url=url_for(self.__class__.list),
         obj=obj,
         pre_delete=pre_delete,
     )
     return view.run(json_result=True)
Esempio n. 5
0
    def delete(self, id):
        """
        删除分类
        """
        obj = self.model.get_or_notfound(int(id))

        if not functions.has_role(request.user, 'superuser'):
            flash("你无权删除分类", 'error')
            return redirect(url_for(TutorialcateView.read, id=id))

        view = functions.DeleteView(self.model, ok_url="/tutorial", obj=obj)
        return view.run()
Esempio n. 6
0
 def _delete(self, model, obj, json_result=False, **kwargs):
     view = functions.DeleteView(model, obj=obj, **kwargs)
     return view.run(json_result=json_result)
Esempio n. 7
0
 def delete(self, id):
     obj = self.model.get_or_notfound(int(id))
     view = functions.DeleteView(self.model, obj=obj)
     return view.run(json_result=True)