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):
...
@@ -1031,5 +1031,5 @@ class ProjectMembersSortForm(forms.Form):
required
=
True
required
=
True
)
)
class
Project
Group
SearchForm
(
forms
.
Form
):
class
ProjectSearchForm
(
forms
.
Form
):
q
=
forms
.
CharField
(
max_length
=
200
,
label
=
'Search project'
)
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):
...
@@ -52,8 +52,8 @@ class Command(NoArgsCommand):
def
handle_noargs
(
self
,
**
options
):
def
handle_noargs
(
self
,
**
options
):
apps
=
ProjectApplication
.
objects
.
select_related
().
all
()
apps
=
ProjectApplication
.
objects
.
select_related
().
all
()
labels
=
(
'id'
,
'name'
,
'state'
)
labels
=
(
'
application.id'
,
'project.
id'
,
'name'
,
'state'
)
columns
=
(
3
,
4
0
,
10
)
columns
=
(
15
,
10
,
2
0
,
10
)
if
not
options
[
'csv'
]:
if
not
options
[
'csv'
]:
line
=
' '
.
join
(
l
.
rjust
(
w
)
for
l
,
w
in
zip
(
labels
,
columns
))
line
=
' '
.
join
(
l
.
rjust
(
w
)
for
l
,
w
in
zip
(
labels
,
columns
))
...
@@ -62,8 +62,13 @@ class Command(NoArgsCommand):
...
@@ -62,8 +62,13 @@ class Command(NoArgsCommand):
self
.
stdout
.
write
(
sep
+
'
\n
'
)
self
.
stdout
.
write
(
sep
+
'
\n
'
)
for
app
in
apps
:
for
app
in
apps
:
try
:
project_id
=
str
(
app
.
project
.
id
)
except
:
project_id
=
''
fields
=
(
fields
=
(
str
(
app
.
id
),
str
(
app
.
id
),
str
(
project_id
),
app
.
definition
.
name
,
app
.
definition
.
name
,
app
.
state
app
.
state
)
)
...
...
snf-astakos-app/astakos/im/models.py
View file @
43f94cc0
...
@@ -1197,6 +1197,7 @@ class ProjectApplication(models.Model):
...
@@ -1197,6 +1197,7 @@ class ProjectApplication(models.Model):
precursor_application_id
=
precursor_application
.
id
precursor_application_id
=
precursor_application
.
id
application
=
precursor_application
application
=
precursor_application
application
.
id
=
None
application
.
id
=
None
application
.
precursor_application
=
None
else
:
else
:
application
=
ProjectApplication
(
owner
=
applicant
)
application
=
ProjectApplication
(
owner
=
applicant
)
application
.
definition
=
definition
application
.
definition
=
definition
...
@@ -1256,10 +1257,15 @@ class ProjectApplication(models.Model):
...
@@ -1256,10 +1257,15 @@ class ProjectApplication(models.Model):
project
.
application
=
self
project
.
application
=
self
project
.
last_approval_date
=
datetime
.
now
()
project
.
last_approval_date
=
datetime
.
now
()
project
.
save
()
project
.
save
()
self
.
precursor_application
.
state
=
REPLACED
precursor
=
self
.
precursor_application
self
.
definition
.
validate_name
()
while
precursor
:
precursor
.
state
=
REPLACED
precursor
.
save
()
precursor
=
precursor
.
precursor_application
self
.
state
=
APPROVED
self
.
state
=
APPROVED
self
.
save
()
self
.
save
()
# self.definition.validate_name()
notification
=
build_notification
(
notification
=
build_notification
(
settings
.
SERVER_EMAIL
,
settings
.
SERVER_EMAIL
,
...
@@ -1280,7 +1286,7 @@ class ProjectApplication(models.Model):
...
@@ -1280,7 +1286,7 @@ class ProjectApplication(models.Model):
if
rejected
:
if
rejected
:
raise
Exception
(
_
(
astakos_messages
.
QH_SYNC_ERROR
))
raise
Exception
(
_
(
astakos_messages
.
QH_SYNC_ERROR
))
else
:
else
:
project
.
last_application_synced
=
app
project
.
last_application_synced
=
self
project
.
save
()
project
.
save
()
...
...
snf-astakos-app/astakos/im/templates/im/projects/project_list.html
View file @
43f94cc0
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
{% endif %}
{% endif %}
{% with page_obj.object_list as object_list %}
{% with page_obj.object_list as object_list %}
<!-- Search
g
ro
up
-->
<!-- Search
p
ro
ject
-->
{% if object_list %}
{% if object_list %}
<div
class=
"full-dotted"
>
<div
class=
"full-dotted"
>
<form
method=
"GET"
class=
"minimal"
action=
"#searchResults"
>
<form
method=
"GET"
class=
"minimal"
action=
"#searchResults"
>
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
{% with o.project.members.all as members %}
{% with o.project.members.all as members %}
{% with o.project.approved_members as approved_members%}
{% with o.project.approved_members as approved_members%}
<tr
class=
"{% cycle 'tr1' 'tr2' %}"
>
<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>{{o.kindname|capfirst}}</td-->
<td
style=
"width:13%"
>
{{o.issue_date|date:"d/m/Y"}}
</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>
<td
style=
"width:13%"
>
{{o.definition.start_date|date:"d/m/Y"}}
</td>
...
@@ -135,8 +135,8 @@
...
@@ -135,8 +135,8 @@
<input
type=
"submit"
value=
"x leave group"
class=
"leave"
/>
<input
type=
"submit"
value=
"x leave group"
class=
"leave"
/>
</form>
</form>
<div
class=
"dialog"
>
<div
class=
"dialog"
>
Are you sure you what to leave this
g
ro
up
?
<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.
group
name}}
</a><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>
{% 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>
<a
href=
"#"
class=
"yes submit"
>
Yes
</a>
<a
href=
"#"
class=
"no submit"
>
No
</a>
</div>
</div>
...
@@ -152,8 +152,8 @@
...
@@ -152,8 +152,8 @@
<input
type=
"submit"
value=
"+ join group"
class=
"join_group join"
/>
<input
type=
"submit"
value=
"+ join group"
class=
"join_group join"
/>
</form>
</form>
<div
class=
"dialog"
>
<div
class=
"dialog"
>
Are you sure you what to join this
g
ro
up
?
<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.
group
name}}
</a><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>
{% 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>
<a
href=
"#"
class=
"yes submit"
>
Yes
</a>
<a
href=
"#"
class=
"no submit"
>
No
</a>
...
@@ -289,8 +289,8 @@
...
@@ -289,8 +289,8 @@
<input
type=
"submit"
value=
"x leave"
class=
"leave"
/>
<input
type=
"submit"
value=
"x leave"
class=
"leave"
/>
</form>
</form>
<div
class=
"dialog"
>
<div
class=
"dialog"
>
Are you sure you want to leave this
g
ro
up
?
<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.
group
name}}
</a><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>
{% 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>
<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 (
...
@@ -82,7 +82,7 @@ from astakos.im.forms import (
TimelineForm
,
PickResourceForm
,
TimelineForm
,
PickResourceForm
,
AstakosGroupCreationSummaryForm
,
AstakosGroupCreationSummaryForm
,
ProjectApplicationForm
,
ProjectSortForm
,
ProjectApplicationForm
,
ProjectSortForm
,
AddProjectMembersForm
,
Project
Group
SearchForm
AddProjectMembersForm
,
ProjectSearchForm
)
)
from
astakos.im.functions
import
(
from
astakos.im.functions
import
(
send_feedback
,
SendMailError
,
send_feedback
,
SendMailError
,
...
@@ -1588,15 +1588,16 @@ def project_detail(request, id):
...
@@ -1588,15 +1588,16 @@ def project_detail(request, id):
@
signed_terms_required
@
signed_terms_required
@
login_required
@
login_required
def
project_search
(
request
):
def
project_search
(
request
):
queryset
=
ProjectApplication
.
objects
.
none
()
queryset
=
ProjectApplication
.
objects
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
form
=
AstakosGroupSearchForm
()
form
=
ProjectSearchForm
()
queryset
=
queryset
.
none
()
else
:
else
:
form
=
AstakosGroup
SearchForm
(
request
.
POST
.
get
(
'q'
)
)
form
=
Project
SearchForm
(
request
.
POST
)
if
form
.
is_valid
():
if
form
.
is_valid
():
q
=
form
.
cleaned_data
[
'q'
].
strip
()
q
=
form
.
cleaned_data
[
'q'
].
strip
()
queryset
=
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
queryset
=
queryset
.
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
queryset
=
queryset
.
filter
(
name__contains
=
q
)
queryset
=
queryset
.
filter
(
definition__
name__contains
=
q
)
sorting
=
'definition__name'
sorting
=
'definition__name'
# validate sorting
# validate sorting
sort_form
=
AstakosGroupSortForm
(
request
.
GET
)
sort_form
=
AstakosGroupSortForm
(
request
.
GET
)
...
@@ -1608,7 +1609,7 @@ def project_search(request):
...
@@ -1608,7 +1609,7 @@ def project_search(request):
queryset
,
queryset
,
paginate_by
=
PAGINATE_BY_ALL
,
paginate_by
=
PAGINATE_BY_ALL
,
page
=
request
.
GET
.
get
(
'page'
)
or
1
,
page
=
request
.
GET
.
get
(
'page'
)
or
1
,
template_name
=
'im/
astakosgroup
_list.html'
,
template_name
=
'im/
projects/project
_list.html'
,
extra_context
=
dict
(
extra_context
=
dict
(
form
=
form
,
form
=
form
,
is_search
=
True
,
is_search
=
True
,
...
@@ -1623,7 +1624,6 @@ def project_search(request):
...
@@ -1623,7 +1624,6 @@ def project_search(request):
def
project_all
(
request
):
def
project_all
(
request
):
q
=
ProjectApplication
.
objects
.
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
q
=
ProjectApplication
.
objects
.
filter
(
~
Q
(
project__last_approval_date__isnull
=
True
))
q
=
q
.
select_related
()
q
=
q
.
select_related
()
sorting
=
'definition__name'
sorting
=
'definition__name'
sort_form
=
ProjectSortForm
(
request
.
GET
)
sort_form
=
ProjectSortForm
(
request
.
GET
)
if
sort_form
.
is_valid
():
if
sort_form
.
is_valid
():
...
@@ -1637,7 +1637,7 @@ def project_all(request):
...
@@ -1637,7 +1637,7 @@ def project_all(request):
page
=
request
.
GET
.
get
(
'page'
)
or
1
,
page
=
request
.
GET
.
get
(
'page'
)
or
1
,
template_name
=
'im/projects/project_list.html'
,
template_name
=
'im/projects/project_list.html'
,
extra_context
=
{
extra_context
=
{
'form'
:
Project
Group
SearchForm
(),
'form'
:
ProjectSearchForm
(),
'is_search'
:
True
,
'is_search'
:
True
,
'sorting'
:
sorting
'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