Пример #1
0
def list_attachments(request, storyID):
    story = mdl_story.get_story(storyID)
    attachments = mdl_attachment.get_attachments_for_story(story)
    form = AttachmentForm()
    context = {
        'attachments': attachments,
        'newform': form,
        'story' : story
    }
    return render(request, 'AttachmentForm.html', context)
def list_attachments(request, storyID):
    story = mdl_story.get_story(storyID)
    attachments = mdl_attachment.get_attachments_for_story(story)
    form = AttachmentForm()
    context = {
        'attachments': attachments,
        'newform': form,
        'story': story
    }
    return render(request, 'AttachmentForm.html', context)
Пример #3
0
def upload_attachments_into_list(request, storyID):

    story = mdl_story.get_story(storyID)
    file = request.FILES['file_' + storyID]
    if request.method == 'POST':
        mdl_attachment.create(storyID, file)
        story.last_updated = datetime.datetime.now()
        story.save()
    attachments = mdl_attachment.get_attachments_for_story(story)
    context = {'attachments': attachments, 'story': story}
    return redirect(request.META['HTTP_REFERER'])
Пример #4
0
 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)
Пример #5
0
def upload_attachments_into_list (request, storyID):
    
    story = mdl_story.get_story(storyID)
    file = request.FILES['file_'+storyID]
    if request.method == 'POST':
        mdl_attachment.create(storyID, file)
        story.last_updated = datetime.datetime.now()
        story.save()
    attachments = mdl_attachment.get_attachments_for_story(story)
    context = {
        'attachments': attachments,
        'story' : story
    }
    return redirect(request.META['HTTP_REFERER'])
Пример #6
0
 def test_attachments_get_attachments_for_non_story(self):
    attach = story_attachment.get_attachments_for_story(None)
    self.assertIsNone(attach, "File attachment should NOT exist")