def delete_attachment(request, storyID): #Delete the attachment uuid=request.GET.get( 'file', '') mdl_attachment.delete(uuid) return redirect(request.META['HTTP_REFERER'])
def delete_attachment(request, storyID): # Delete the attachment uuid = request.GET.get( 'file', '' ) mdl_attachment.delete(uuid) return redirect(request.META['HTTP_REFERER'])
def test_attachments_file_attachment(self): fields = {"title": "title", "description": "desc", "reason": "reason", "test": "test", "status": 1} s = models.story.create_story(self.__project, fields) self.assertEqual(1, self.__project.story_set.count()) models.story_attachment.create(s.id, SimpleUploadedFile('test_it.txt', 'This is some text to add to the file')) attach = story_attachment.get_attachments_for_story(s) self.assertIsNotNone(attach, "File attachment should exist") for a in story_attachment.get_all_attachments(): story_attachment.delete(a.uuid)