Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
manhattan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
InnovacionDocente
manhattan
Commits
f773a56a
Commit
f773a56a
authored
Jan 28, 2020
by
Enrique Matías Sánchez (Quique)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enh Sólo permitir solicitar PIET a los coordinadores de los estudios
parent
eefb9e0e
Pipeline
#511
failed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
forms.py
indo/forms.py
+15
-1
models.py
indo/models.py
+4
-1
views.py
indo/views.py
+2
-1
No files found.
indo/forms.py
View file @
f773a56a
...
...
@@ -128,7 +128,21 @@ class ProyectoForm(forms.ModelForm):
)
if
programa
.
nombre_corto
==
"PIET"
and
not
estudio
:
self
.
add_error
(
"estudio"
,
_
(
"Los PIET deben estar vinculado a un estudio."
))
self
.
add_error
(
"estudio"
,
_
(
"Los PIET deben estar vinculados a un estudio."
)
)
nip_coordinadores
=
list
(
map
(
lambda
p
:
f
"{p.nip_coordinador}"
,
estudio
.
planes
.
all
())
)
if
(
programa
.
nombre_corto
==
"PIET"
and
self
.
instance
.
user
.
username
not
in
nip_coordinadores
):
self
.
add_error
(
"estudio"
,
_
(
"Los PIET sólo los pueden solicitar los coordinadores del estudio."
),
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
...
...
indo/models.py
View file @
f773a56a
...
...
@@ -169,7 +169,9 @@ class Plan(models.Model):
)
esta_activo
=
models
.
BooleanField
(
_
(
"¿Activo?"
),
default
=
True
)
centro
=
models
.
ForeignKey
(
"Centro"
,
on_delete
=
models
.
PROTECT
)
estudio
=
models
.
ForeignKey
(
"Estudio"
,
on_delete
=
models
.
PROTECT
)
estudio
=
models
.
ForeignKey
(
"Estudio"
,
on_delete
=
models
.
PROTECT
,
related_name
=
"planes"
)
class
ParticipanteProyecto
(
models
.
Model
):
...
...
@@ -484,6 +486,7 @@ class Proyecto(models.Model):
except
ParticipanteProyecto
.
DoesNotExist
:
return
None
# TODO: Soporte para coordinador_principal
def
get_usuario_coordinador
(
self
):
pp
=
ParticipanteProyecto
.
objects
.
get
(
proyecto_id
=
self
.
id
,
tipo_participacion_id
=
"coordinador"
...
...
indo/views.py
View file @
f773a56a
...
...
@@ -284,9 +284,10 @@ class ProyectoCreateView(LoginRequiredMixin, ChecksMixin, CreateView):
def
get_form
(
self
,
form_class
=
None
):
"""
Devuelve el formulario añadiendo automáticamente el campo Convocatoria,
que es requerido.
que es requerido
, y el usuario, para comprobar si tiene los permisos necesarios
.
"""
form
=
super
(
ProyectoCreateView
,
self
)
.
get_form
(
form_class
)
form
.
instance
.
user
=
self
.
request
.
user
form
.
instance
.
convocatoria
=
Convocatoria
(
date
.
today
()
.
year
)
return
form
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment