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}
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 }
def setup(self, request, last_post=None, initial=None): if initial: self.fields['id'].initial = initial.id self.fields['story'].initial = Converter.django_story_to_text(initial, initial.task_set.all())
def setup(self, request, last_post=None, initial=None): if initial: self.fields['id'].initial = initial.id self.fields['story'].initial = Converter.django_story_to_text( initial, initial.task_set.all().order_by('id'))
def storyparser_format(story): return Converter.django_story_to_text(story, story.task_set.all())