Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
43f94cc0
Commit
43f94cc0
authored
Dec 11, 2012
by
Sofia Papagiannaki
Browse files
Fix sequence of project applications & project search
parent
d98f15ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/forms.py
View file @
43f94cc0
...
...
@@ -1031,5 +1031,5 @@ class ProjectMembersSortForm(forms.Form):
required
=
True
)
class
Project
Group
SearchForm
(
forms
.
Form
):
class
ProjectSearchForm
(
forms
.
Form
):
q
=
forms
.
CharField
(
max_length
=
200
,
label
=
'Search project'
)
\ No newline at end of file
snf-astakos-app/astakos/im/management/commands/project-list.py
View file @
43f94cc0
...
...
@@ -52,8 +52,8 @@ class Command(NoArgsCommand):
def
handle_noargs
(
self
,
**
options
):
apps
=
ProjectApplication
.
objects
.
select_related
().
all
()
labels
=
(
'id'
,
'name'
,
'state'
)
columns
=
(
3
,
4
0
,
10
)
labels
=
(
'
application.id'
,
'project.
id'
,
'name'
,
'state'
)
columns
=
(
15
,
10
,
2
0
,
10
)
if
not
options
[
'csv'
]:
line
=
' '
.
join
(
l
.
rjust
(
w
)
for
l
,
w
in
zip
(
labels
,
columns
))
...
...
@@ -62,8 +62,13 @@ class Command(NoArgsCommand):
self
.
stdout
.
write
(
sep
+
'
\n
'
)
for
app
in
apps
:
try
:
project_id
=
str
(
app
.
project
.
id
)
except
:
project_id
=
''
fields
=
(
str
(
app
.
id
),
str
(
project_id
),
app
.
definition
.
name
,
app
.
state
)
...
...
snf-astakos-app/astakos/im/models.py
View file @
43f94cc0
...
...
@@ -1197,6 +1197,7 @@ class ProjectApplication(models.Model):
precursor_application_id
=
precursor_application
.
id
application
=
precursor_application
application
.
id
=
None
application
.
precursor_application
=
None
else
:
application
=
ProjectApplication
(
owner
=
applicant
)
application
.
definition
=
definition
...
...
@@ -1256,10 +1257,15 @@ class ProjectApplication(models.Model):
project
.
application
=
self
project
.
last_approval_date
=
datetime
.
now
()
project
.
save
()
self
.
precursor_application
.
state
=
REPLACED
self
.
definition
.
validate_name
()
precursor
=
self
.
precursor_application
while
precursor
:
precursor
.
state
=
REPLACED
precursor
.
save
()
precursor
=
precursor
.
precursor_application
self
.
state
=
APPROVED
self
.
save
()
# self.definition.validate_name()
notification
=
build_notification
(
settings
.
SERVER_EMAIL
,
...
...
@@ -1280,7 +1286,7 @@ class ProjectApplication(models.Model):
if
rejected
:
raise
Exception
(
_
(
astakos_messages
.
QH_SYNC_ERROR
))
else
:
project
.
last_application_synced
=
app
project
.
last_application_synced
=
self
project
.
save
()
...
...
snf-astakos-app/astakos/im/templates/im/projects/project_list.html
View file @
43f94cc0
...
...
@@ -55,7 +55,7 @@
{% endif %}
{% with page_obj.object_list as object_list %}
<!-- Search
g
ro
up
-->
<!-- Search
p
ro
ject
-->
{% if object_list %}
<div
class=
"full-dotted"
>
<form
method=
"GET"
class=
"minimal"
action=
"#searchResults"
>
...
...
@@ -99,7 +99,7 @@
{% with o.project.members.all as members %}
{% with o.project.approved_members as approved_members%}
<tr
class=
"{% cycle 'tr1' 'tr2' %}"
>
<td
style=
"width:22%"
><a
href=
"{% url project_detail o.id %}"
title=
"visit
g
ro
up
page"
>
{{o.definition.name|truncatename}}
</a></td>
<td
style=
"width:22%"
><a
href=
"{% url project_detail o.id %}"
title=
"visit
p
ro
ject
page"
>
{{o.definition.name|truncatename}}
</a></td>
<!--td>{{o.kindname|capfirst}}</td-->
<td
style=
"width:13%"
>
{{o.issue_date|date:"d/m/Y"}}
</td>
<td
style=
"width:13%"
>
{{o.definition.start_date|date:"d/m/Y"}}
</td>
...
...
@@ -135,8 +135,8 @@
<input
type=
"submit"
value=
"x leave group"
class=
"leave"
/>
</form>
<div
class=
"dialog"
>
Are you sure you what to leave this
g
ro
up
?
<br>
Name:
<a
href=
"{% url project_detail o.id %}"
title=
"visit group page"
>
{{o.
group
name}}
</a><br>
Are you sure you what to leave this
p
ro
ject
?
<br>
Name:
<a
href=
"{% url project_detail o.id %}"
title=
"visit group page"
>
{{o.
definition.
name}}
</a><br>
{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}
<br><br>
<a
href=
"#"
class=
"yes submit"
>
Yes
</a>
<a
href=
"#"
class=
"no submit"
>
No
</a>
</div>
...
...
@@ -152,8 +152,8 @@
<input
type=
"submit"
value=
"+ join group"
class=
"join_group join"
/>
</form>
<div
class=
"dialog"
>
Are you sure you what to join this
g
ro
up
?
<br>
Name:
<a
href=
"{% url project_detail o.id %}"
title=
"visit group page"
>
{{o.
group
name}}
</a><br>
Are you sure you what to join this
p
ro
ject
?
<br>
Name:
<a
href=
"{% url project_detail o.id %}"
title=
"visit group page"
>
{{o.
definition.
name}}
</a><br>
{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}
<br><br>
<a
href=
"#"
class=
"yes submit"
>
Yes
</a>
<a
href=
"#"
class=
"no submit"
>
No
</a>
...
...
@@ -289,8 +289,8 @@
<input
type=
"submit"
value=
"x leave"
class=
"leave"
/>
</form>
<div
class=
"dialog"
>
Are you sure you want to leave this
g
ro
up
?
<br>
Name:
<a
href=
"{% url project_detail o.id %}"
title=
"visit group page"
>
{{o.
group
name}}
</a><br>
Are you sure you want to leave this
p
ro
ject
?
<br>
Name:
<a
href=
"{% url project_detail o.id %}"
title=
"visit group page"
>
{{o.
definition.
name}}
</a><br>
{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}
<br><br>
<a
href=
"#"
class=
"yes submit"
>
Yes
</a>
<a
href=
"#"
class=
"no submit"
>
No
</a>
...
...
snf-astakos-app/astakos/im/views.py
View file @
43f94cc0
...
...
@@ -82,7 +82,7 @@ from astakos.im.forms import (
TimelineForm
,
PickResourceForm
,
AstakosGroupCreationSummaryForm
,
ProjectApplicationForm
,
ProjectSortForm
,
AddProjectMembersForm
,
Project
Group
SearchForm
AddProjectMembersForm
,
ProjectSearchForm
)
from
astakos.im.functions
import
(
send_feedback
,
SendMailError
,
...
...
@@ -1588,15 +1588,16 @@ def project_detail(request, id):
@
signed_terms_required
@
login_required
def
project_search
(
request
):
queryset
=
ProjectApplication
.
objects
.
none
()
queryset
=
ProjectApplication
.
objects
if
request
.
method
==
'GET'
:
form
=
AstakosGroupSearchForm
()
form
=
ProjectSearchForm
()
queryset
=
queryset
.
none
()
else
:
form
=
AstakosGroup
SearchForm
(
request
.
POST
.
get
(
'q'
)
)
form
=
Project
SearchForm
(
request
.
POST
)
if
form
.
is_valid
():
q
=
form
.
cleaned_data
[
'q'
].
strip
()
queryset
=
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
queryset
=
queryset
.
filter
(
name__contains
=
q
)
queryset
=
queryset
.
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
queryset
=
queryset
.
filter
(
definition__
name__contains
=
q
)
sorting
=
'definition__name'
# validate sorting
sort_form
=
AstakosGroupSortForm
(
request
.
GET
)
...
...
@@ -1608,7 +1609,7 @@ def project_search(request):
queryset
,
paginate_by
=
PAGINATE_BY_ALL
,
page
=
request
.
GET
.
get
(
'page'
)
or
1
,
template_name
=
'im/
astakosgroup
_list.html'
,
template_name
=
'im/
projects/project
_list.html'
,
extra_context
=
dict
(
form
=
form
,
is_search
=
True
,
...
...
@@ -1623,7 +1624,6 @@ def project_search(request):
def
project_all
(
request
):
q
=
ProjectApplication
.
objects
.
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
q
=
q
.
select_related
()
sorting
=
'definition__name'
sort_form
=
ProjectSortForm
(
request
.
GET
)
if
sort_form
.
is_valid
():
...
...
@@ -1637,7 +1637,7 @@ def project_all(request):
page
=
request
.
GET
.
get
(
'page'
)
or
1
,
template_name
=
'im/projects/project_list.html'
,
extra_context
=
{
'form'
:
Project
Group
SearchForm
(),
'form'
:
ProjectSearchForm
(),
'is_search'
:
True
,
'sorting'
:
sorting
}
...
...
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