Пример #1
0
    def save(self, commit=True):
        if not commit:
            raise NotImplementedError(
                "Can't create UserStory without database save")
        #userStory = super(UserStoryCreateForm, self).save(commit=True)
        proyecto = Proyecto.objects.get(pk=self.instance.pk)

        userStory = UserStory.objects.create(
            nombre=self.cleaned_data['nombre'],
            descripcion=self.cleaned_data['descripcion'],
            prioridad=self.cleaned_data['prioridad'],
            valor_tecnico=self.cleaned_data['valor_tecnico'],
            estimacion=self.cleaned_data['estimacion'],
            proyecto=proyecto)
        print userStory
        print proyecto

        #userStory.proyecto = self.cleaned_data['proyecto']
        #print self.cleaned_data['proyecto']
        userStory.save()
        print userStory

        historial_us = HistorialUserStory(user_story=userStory,
                                          operacion='creado',
                                          usuario=self.user)
        historial_us.save()

        #print "nombre %s" % self.cleaned_data['nombre']
        return proyecto
Пример #2
0
    def save(self, commit=True):
        cleaned_data = super(UserStoryUpdateFormPO, self).clean()
        proyecto = Proyecto.objects.get(pk=self.instance.pk)

        proyecto = super(UserStoryUpdateFormPO, self).save(commit=True)
        user_story = UserStory.objects.get(pk=self.cleaned_data['id'])

        if user_story.nombre != cleaned_data['nombre']:
            user_story.nombre = self.cleaned_data['nombre']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="nombre",
                                              valor=self.cleaned_data['nombre'], usuario=self.user)
            historial_us.save()
            print 'cambio el nombre %s ' % user_story.nombre
        if user_story.descripcion != cleaned_data['descripcion']:
            user_story.descripcion = self.cleaned_data['descripcion']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="descripcion",
                                              valor=self.cleaned_data['descripcion'], usuario=self.user)
            historial_us.save()
            print 'cambio la descripcion antes: %s - ahora: %s' % (user_story.descripcion, cleaned_data['descripcion'])
        if user_story.valor_negocio != cleaned_data['valor_negocio']:
            user_story.valor_negocio = self.cleaned_data['valor_negocio']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="valor de negocio",
                                              valor=self.cleaned_data['valor_negocio'], usuario=self.user)
            historial_us.save()
            print 'cambio el valor de negocio %s ' % user_story.valor_negocio

        user_story.save()

        return proyecto
Пример #3
0
def descartar_user_story(request, pk_proyecto, pk_user_story):
    """
    Metodo que descarta un user story

    @param request:
    @type

    @param pk_proyecto: clave primaria del proyecto al cual corresponde el user story
    @type

    @param pk_user_story: clave primaria del user story
    @type

    @rtype: django.http.HttpResponseRedirect
    @return: Renderiza user_stories/delete.html para obtener el formulario o
            redirecciona a la vista index de User Stories si el user story fue descartado.
    """
    template = 'user_stories/delete.html'
    proyecto = get_object_or_404(Proyecto, pk=pk_proyecto)
    user_story = get_object_or_404(UserStory, pk=pk_user_story)
    usuario = request.user
    if request.method == 'POST':

        if str(user_story.estado) == 'Finalizado' or str(
                user_story.estado) == 'Aprobado':
            mensaje = 'No se puede descartar un user story Finalizado o Aprobado'

            return render(request, template, locals())

        else:
            user_story.estado = 'Descartado'
            user_story.save()

            historial_us = HistorialUserStory(user_story=user_story,
                                              operacion='descartado',
                                              usuario=usuario)
            historial_us.save()

            return HttpResponseRedirect(
                reverse('user_stories:index', args=[proyecto.pk]))

    return render(request, template, locals())
Пример #4
0
def descartar_user_story(request, pk_proyecto, pk_user_story):
    """
    Metodo que descarta un user story

    @param request:
    @type

    @param pk_proyecto: clave primaria del proyecto al cual corresponde el user story
    @type

    @param pk_user_story: clave primaria del user story
    @type

    @rtype: django.http.HttpResponseRedirect
    @return: Renderiza user_stories/delete.html para obtener el formulario o
            redirecciona a la vista index de User Stories si el user story fue descartado.
    """
    template = 'user_stories/delete.html'
    proyecto = get_object_or_404(Proyecto, pk=pk_proyecto)
    user_story = get_object_or_404(UserStory, pk=pk_user_story)
    usuario = request.user
    if request.method == 'POST':

        if str(user_story.estado) == 'Finalizado' or str(user_story.estado) == 'Aprobado':
            mensaje = 'No se puede descartar un user story Finalizado o Aprobado'

            return render(request, template, locals())

        else:
            user_story.estado = 'Descartado'
            user_story.save()

            historial_us = HistorialUserStory(user_story=user_story, operacion='descartado', usuario=usuario)
            historial_us.save()

            return HttpResponseRedirect(reverse('user_stories:index', args=[proyecto.pk]))

    return render(request, template, locals())
Пример #5
0
    def save(self, commit=True):
        if not commit:
            raise NotImplementedError("Can't create UserStory without database save")
        #userStory = super(UserStoryCreateForm, self).save(commit=True)
        proyecto = Proyecto.objects.get(pk=self.instance.pk)

        userStory = UserStory.objects.create(nombre=self.cleaned_data['nombre'],
                                             descripcion=self.cleaned_data['descripcion'],
                                             valor_negocio=self.cleaned_data['valor_negocio'],
                                             proyecto=proyecto)
        print userStory
        print proyecto

        #userStory.proyecto = self.cleaned_data['proyecto']
        #print self.cleaned_data['proyecto']
        userStory.save()
        print userStory

        historial_us = HistorialUserStory(user_story=userStory, operacion='creado', usuario=self.user)
        historial_us.save()

        #print "nombre %s" % self.cleaned_data['nombre']
        return proyecto
Пример #6
0
    def save(self, commit=True):
        cleaned_data = super(UserStoryUpdateFormSM, self).clean()
        proyecto = Proyecto.objects.get(pk=self.instance.pk)

        proyecto = super(UserStoryUpdateFormSM, self).save(commit=True)

        user_story = UserStory.objects.get(pk=self.cleaned_data['id'])

        if user_story.usuario is None:
            user_story.estado = 'No asignado'
        elif user_story.usuario is not None:
            if str(user_story.estado) == 'Finalizado' or str(user_story.estado) == 'Aprobado':
                pass
            else:
                user_story.estado = 'Activo'

        if user_story.prioridad != cleaned_data['prioridad']:
            user_story.prioridad = self.cleaned_data['prioridad']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="prioridad",
                                              valor=self.cleaned_data['prioridad'], usuario=self.user)
            historial_us.save()

        if user_story.valor_tecnico != cleaned_data['valor_tecnico']:
            user_story.valor_tecnico = self.cleaned_data['valor_tecnico']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="valor tecnico",
                                              valor=self.cleaned_data['valor_tecnico'], usuario=self.user)
            historial_us.save()

        if user_story.estimacion != cleaned_data['estimacion']:
            user_story.estimacion = self.cleaned_data['estimacion']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="estimacion",
                                              valor=self.cleaned_data['estimacion'], usuario=self.user)
            historial_us.save()

        if user_story.flujo != cleaned_data['flujo']:
            user_story.flujo = self.cleaned_data['flujo']
            historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="flujo",
                                              valor=self.cleaned_data['flujo'], usuario=self.user)
            historial_us.save()

        user_story.save()

        return proyecto
Пример #7
0
    def save(self, commit=True):
        cleaned_data = super(UserStoryUpdateFormSM, self).clean()
        proyecto = Proyecto.objects.get(pk=self.instance.pk)

        proyecto = super(UserStoryUpdateFormSM, self).save(commit=True)

        user_story = UserStory.objects.get(pk=self.cleaned_data['id'])

        if user_story.usuario is None:
            user_story.estado = 'No asignado'
        elif user_story.usuario is not None:
            if str(user_story.estado) == 'Finalizado' or str(
                    user_story.estado) == 'Aprobado':
                pass
            else:
                user_story.estado = 'Activo'

        if user_story.nombre != cleaned_data['nombre']:
            user_story.nombre = self.cleaned_data['nombre']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="nombre",
                valor=self.cleaned_data['nombre'],
                usuario=self.user)
            historial_us.save()

        if user_story.descripcion != cleaned_data['descripcion']:
            user_story.descripcion = self.cleaned_data['descripcion']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="descripcion",
                valor=self.cleaned_data['descripcion'],
                usuario=self.user)
            historial_us.save()

        if user_story.prioridad != cleaned_data['prioridad']:
            user_story.prioridad = self.cleaned_data['prioridad']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="prioridad",
                valor=self.cleaned_data['prioridad'],
                usuario=self.user)
            historial_us.save()

        if user_story.valor_tecnico != cleaned_data['valor_tecnico']:
            user_story.valor_tecnico = self.cleaned_data['valor_tecnico']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="valor tecnico",
                valor=self.cleaned_data['valor_tecnico'],
                usuario=self.user)
            historial_us.save()

        if user_story.estimacion != cleaned_data['estimacion']:
            user_story.estimacion = self.cleaned_data['estimacion']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="estimacion",
                valor=self.cleaned_data['estimacion'],
                usuario=self.user)
            historial_us.save()

        #if user_story.flujo != cleaned_data['flujo']:
        #    user_story.flujo = self.cleaned_data['flujo']
        #    historial_us = HistorialUserStory(user_story=user_story, operacion='modificado', campo="flujo",
        #                                      valor=self.cleaned_data['flujo'], usuario=self.user)
        #    historial_us.save()

        user_story.save()

        return proyecto
Пример #8
0
    def save(self, commit=True):
        cleaned_data = super(UserStoryUpdateFormPO, self).clean()
        proyecto = Proyecto.objects.get(pk=self.instance.pk)

        proyecto = super(UserStoryUpdateFormPO, self).save(commit=True)
        user_story = UserStory.objects.get(pk=self.cleaned_data['id'])

        if user_story.nombre != cleaned_data['nombre']:
            user_story.nombre = self.cleaned_data['nombre']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="nombre",
                valor=self.cleaned_data['nombre'],
                usuario=self.user)
            historial_us.save()
            print 'cambio el nombre %s ' % user_story.nombre
        if user_story.descripcion != cleaned_data['descripcion']:
            user_story.descripcion = self.cleaned_data['descripcion']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="descripcion",
                valor=self.cleaned_data['descripcion'],
                usuario=self.user)
            historial_us.save()
            print 'cambio la descripcion antes: %s - ahora: %s' % (
                user_story.descripcion, cleaned_data['descripcion'])
        if user_story.valor_negocio != cleaned_data['valor_negocio']:
            user_story.valor_negocio = self.cleaned_data['valor_negocio']
            historial_us = HistorialUserStory(
                user_story=user_story,
                operacion='modificado',
                campo="valor de negocio",
                valor=self.cleaned_data['valor_negocio'],
                usuario=self.user)
            historial_us.save()
            print 'cambio el valor de negocio %s ' % user_story.valor_negocio

        user_story.save()

        return proyecto