Revision 6dadd24a
b/snf-astakos-app/astakos/im/forms.py | ||
---|---|---|
1031 | 1031 |
required=True |
1032 | 1032 |
) |
1033 | 1033 |
|
1034 |
class ProjectGroupSearchForm(forms.Form):
|
|
1034 |
class ProjectSearchForm(forms.Form): |
|
1035 | 1035 |
q = forms.CharField(max_length=200, label='Search project') |
b/snf-astakos-app/astakos/im/management/commands/project-list.py | ||
---|---|---|
52 | 52 |
def handle_noargs(self, **options): |
53 | 53 |
apps = ProjectApplication.objects.select_related().all() |
54 | 54 |
|
55 |
labels = ('id', 'name', 'state') |
|
56 |
columns = (3, 40, 10)
|
|
55 |
labels = ('application.id', 'project.id', 'name', 'state')
|
|
56 |
columns = (15, 10, 20, 10)
|
|
57 | 57 |
|
58 | 58 |
if not options['csv']: |
59 | 59 |
line = ' '.join(l.rjust(w) for l, w in zip(labels, columns)) |
... | ... | |
62 | 62 |
self.stdout.write(sep + '\n') |
63 | 63 |
|
64 | 64 |
for app in apps: |
65 |
try: |
|
66 |
project_id = str(app.project.id) |
|
67 |
except: |
|
68 |
project_id = '' |
|
65 | 69 |
fields = ( |
66 | 70 |
str(app.id), |
71 |
str(project_id), |
|
67 | 72 |
app.definition.name, |
68 | 73 |
app.state |
69 | 74 |
) |
b/snf-astakos-app/astakos/im/models.py | ||
---|---|---|
1197 | 1197 |
precursor_application_id = precursor_application.id |
1198 | 1198 |
application = precursor_application |
1199 | 1199 |
application.id = None |
1200 |
application.precursor_application = None |
|
1200 | 1201 |
else: |
1201 | 1202 |
application = ProjectApplication(owner=applicant) |
1202 | 1203 |
application.definition = definition |
... | ... | |
1256 | 1257 |
project.application = self |
1257 | 1258 |
project.last_approval_date = datetime.now() |
1258 | 1259 |
project.save() |
1259 |
self.precursor_application.state = REPLACED |
|
1260 |
self.definition.validate_name() |
|
1260 |
precursor = self.precursor_application |
|
1261 |
while precursor: |
|
1262 |
precursor.state = REPLACED |
|
1263 |
precursor.save() |
|
1264 |
precursor = precursor.precursor_application |
|
1261 | 1265 |
self.state = APPROVED |
1262 | 1266 |
self.save() |
1267 |
|
|
1268 |
# self.definition.validate_name() |
|
1263 | 1269 |
|
1264 | 1270 |
notification = build_notification( |
1265 | 1271 |
settings.SERVER_EMAIL, |
... | ... | |
1280 | 1286 |
if rejected: |
1281 | 1287 |
raise Exception(_(astakos_messages.QH_SYNC_ERROR)) |
1282 | 1288 |
else: |
1283 |
project.last_application_synced = app
|
|
1289 |
project.last_application_synced = self
|
|
1284 | 1290 |
project.save() |
1285 | 1291 |
|
1286 | 1292 |
|
b/snf-astakos-app/astakos/im/templates/im/projects/project_list.html | ||
---|---|---|
55 | 55 |
|
56 | 56 |
{% endif %} |
57 | 57 |
{% with page_obj.object_list as object_list %} |
58 |
<!-- Search group -->
|
|
58 |
<!-- Search project -->
|
|
59 | 59 |
{% if object_list %} |
60 | 60 |
<div class="full-dotted"> |
61 | 61 |
<form method="GET" class="minimal" action="#searchResults"> |
... | ... | |
99 | 99 |
{% with o.project.members.all as members %} |
100 | 100 |
{% with o.project.approved_members as approved_members%} |
101 | 101 |
<tr class="{% cycle 'tr1' 'tr2' %}"> |
102 |
<td style="width:22%"><a href="{% url project_detail o.id %}" title="visit group page">{{o.definition.name|truncatename}}</a></td>
|
|
102 |
<td style="width:22%"><a href="{% url project_detail o.id %}" title="visit project page">{{o.definition.name|truncatename}}</a></td>
|
|
103 | 103 |
<!--td>{{o.kindname|capfirst}}</td--> |
104 | 104 |
<td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td> |
105 | 105 |
<td style="width:13%">{{o.definition.start_date|date:"d/m/Y"}}</td> |
... | ... | |
135 | 135 |
<input type="submit" value="x leave group" class="leave"/> |
136 | 136 |
</form> |
137 | 137 |
<div class="dialog"> |
138 |
Are you sure you what to leave this group?<br>
|
|
139 |
Name: <a href="{% url project_detail o.id %}" title="visit group page">{{o.groupname}}</a><br>
|
|
138 |
Are you sure you what to leave this project?<br>
|
|
139 |
Name: <a href="{% url project_detail o.id %}" title="visit group page">{{o.definition.name}}</a><br>
|
|
140 | 140 |
{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br> |
141 | 141 |
<a href="#" class="yes submit">Yes</a> <a href="#" class="no submit">No</a> |
142 | 142 |
</div> |
... | ... | |
152 | 152 |
<input type="submit" value="+ join group" class="join_group join" /> |
153 | 153 |
</form> |
154 | 154 |
<div class="dialog"> |
155 |
Are you sure you what to join this group?<br>
|
|
156 |
Name: <a href="{% url project_detail o.id %}" title="visit group page">{{o.groupname}}</a><br>
|
|
155 |
Are you sure you what to join this project?<br>
|
|
156 |
Name: <a href="{% url project_detail o.id %}" title="visit group page">{{o.definition.name}}</a><br>
|
|
157 | 157 |
{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br> |
158 | 158 |
|
159 | 159 |
<a href="#" class="yes submit">Yes</a> <a href="#" class="no submit">No</a> |
... | ... | |
289 | 289 |
<input type="submit" value="x leave" class="leave" /> |
290 | 290 |
</form> |
291 | 291 |
<div class="dialog"> |
292 |
Are you sure you want to leave this group?<br>
|
|
293 |
Name: <a href="{% url project_detail o.id %}" title="visit group page">{{o.groupname}}</a><br>
|
|
292 |
Are you sure you want to leave this project?<br>
|
|
293 |
Name: <a href="{% url project_detail o.id %}" title="visit group page">{{o.definition.name}}</a><br>
|
|
294 | 294 |
{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br> |
295 | 295 |
|
296 | 296 |
<a href="#" class="yes submit">Yes</a> <a href="#" class="no submit">No</a> |
b/snf-astakos-app/astakos/im/views.py | ||
---|---|---|
82 | 82 |
TimelineForm, PickResourceForm, |
83 | 83 |
AstakosGroupCreationSummaryForm, |
84 | 84 |
ProjectApplicationForm, ProjectSortForm, |
85 |
AddProjectMembersForm, ProjectGroupSearchForm
|
|
85 |
AddProjectMembersForm, ProjectSearchForm |
|
86 | 86 |
) |
87 | 87 |
from astakos.im.functions import ( |
88 | 88 |
send_feedback, SendMailError, |
... | ... | |
1588 | 1588 |
@signed_terms_required |
1589 | 1589 |
@login_required |
1590 | 1590 |
def project_search(request): |
1591 |
queryset = ProjectApplication.objects.none()
|
|
1591 |
queryset = ProjectApplication.objects |
|
1592 | 1592 |
if request.method == 'GET': |
1593 |
form = AstakosGroupSearchForm() |
|
1593 |
form = ProjectSearchForm() |
|
1594 |
queryset = queryset.none() |
|
1594 | 1595 |
else: |
1595 |
form = AstakosGroupSearchForm(request.POST.get('q'))
|
|
1596 |
form = ProjectSearchForm(request.POST)
|
|
1596 | 1597 |
if form.is_valid(): |
1597 | 1598 |
q = form.cleaned_data['q'].strip() |
1598 |
queryset = filter(~Q(project__last_approval_date__isnull=True)) |
|
1599 |
queryset = queryset.filter(name__contains=q) |
|
1599 |
queryset = queryset.filter(~Q(project__last_approval_date__isnull=True))
|
|
1600 |
queryset = queryset.filter(definition__name__contains=q)
|
|
1600 | 1601 |
sorting = 'definition__name' |
1601 | 1602 |
# validate sorting |
1602 | 1603 |
sort_form = AstakosGroupSortForm(request.GET) |
... | ... | |
1608 | 1609 |
queryset, |
1609 | 1610 |
paginate_by=PAGINATE_BY_ALL, |
1610 | 1611 |
page=request.GET.get('page') or 1, |
1611 |
template_name='im/astakosgroup_list.html',
|
|
1612 |
template_name='im/projects/project_list.html',
|
|
1612 | 1613 |
extra_context=dict( |
1613 | 1614 |
form=form, |
1614 | 1615 |
is_search=True, |
... | ... | |
1623 | 1624 |
def project_all(request): |
1624 | 1625 |
q = ProjectApplication.objects.filter(~Q(project__last_approval_date__isnull=True)) |
1625 | 1626 |
q = q.select_related() |
1626 |
|
|
1627 | 1627 |
sorting = 'definition__name' |
1628 | 1628 |
sort_form = ProjectSortForm(request.GET) |
1629 | 1629 |
if sort_form.is_valid(): |
... | ... | |
1637 | 1637 |
page=request.GET.get('page') or 1, |
1638 | 1638 |
template_name='im/projects/project_list.html', |
1639 | 1639 |
extra_context={ |
1640 |
'form':ProjectGroupSearchForm(),
|
|
1640 |
'form':ProjectSearchForm(), |
|
1641 | 1641 |
'is_search':True, |
1642 | 1642 |
'sorting':sorting |
1643 | 1643 |
} |
Also available in: Unified diff