Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modificacion de helper #10

Merged
merged 2 commits into from
Mar 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions app/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@








def get_permisos_sistema(user):
roles = UsuarioRolSistema.objects.filter(usuario = user).only('rol')
permisos_obj = []
Expand Down Expand Up @@ -55,25 +50,3 @@ def registrar_version(itm, relaciones, archivos):
"""Se incrementa la version actual"""
itm.version = itm.version + 1
itm.save()

def tiene_padre (hijo, padres):
for i in padres:
if (i.fase.id == hijo.fase.id - 1):
return True
else:
relaciones = RelItem.objects.filter(hijo=i, habilitado=True).values_list('padre', flat=True)
if (relaciones):
padres = Item.objects.filter(id__in = relaciones)
return tiene_padre (i, padres)
return False

def tiene_hijo (padre, hijos):
for i in hijos:
if (i.fase.id == padre.fase.id + 1):
return True
else:
relaciones = RelItem.objects.filter(padre=i, habilitado=True).values_list('hijo', flat=True)
if (relaciones):
hijos = Item.objects.filter(id__in = relaciones)
return tiene_hijo (i, hijos)
return False
2 changes: 1 addition & 1 deletion app/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_add_user(self):

def crear_rol(self, nombre='administrador', descripcion ='Se encarga de la administracion general', categoria=1):
return Rol.objects.create(nombre=nombre, descripcion=descripcion, categoria= categoria)

#Test para crear Rol
def test_crear_rol(self):
rol= self.crear_rol(nombre ='administrador')
self.assertTrue(isinstance(rol,Rol))
Expand Down