Example #1
0
    def process(self, request):
        story, tasks = Converter.text_to_django_story(
            self.cleaned_data['story'].replace(r'\r\n', r'\n'))
        if self.cleaned_data['id'] and self.cleaned_data['id'] != '':
            existing_story = models.Story.objects.get(
                id=self.cleaned_data['id'])
            story.created_by = request.user
            story.id = existing_story.id
            story.sprint = existing_story.sprint
            story.state = existing_story.state
            story.created_by = request.user
        else:
            existing_story = None
            story.state = 'BACKLOG'
            story.created_by = request.user
        story.save()

        for task in story.task_set.all():
            task.delete()

        for task in tasks:
            task.story = story
            task.save()

        return {'story': story}
Example #2
0
	def process(self, request):
		story, tasks = Converter.text_to_django_story(self.cleaned_data['story'].replace(r'\r\n', r'\n'))
		if self.cleaned_data['id'] and self.cleaned_data['id'] != '':
			existing_story = models.Story.objects.get(id=self.cleaned_data['id'])
			story.created_by = request.user
			story.id = existing_story.id
			story.sprint = existing_story.sprint
			story.state = existing_story.state
			story.created_by = request.user
		else:
			existing_story = None
			story.state = 'BACKLOG'
			story.created_by = request.user
		story.save()

		for task in story.task_set.all():
			task.delete()

		for task in tasks:
			task.story = story
			task.save()

		return {
			'story': story
		}