Commit cd9b4efc authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Merge remote-tracking branch 'synnefo/feature-astakos-tables' into feature-astakos-tables

Conflicts:
	snf-astakos-app/astakos/im/tables.py
parents 2c29b81b 302609a3
......@@ -1175,6 +1175,8 @@ class ProjectApplication(models.Model):
try:
membership = self.project.projectmembership_set.get(person=user)
status = membership.state
except Project.DoesNotExist:
status = -1
except ProjectMembership.DoesNotExist:
status = -1
......
......@@ -187,7 +187,6 @@ class UserProjectApplicationsTable(tables.Table):
name = tables.LinkColumn('astakos.im.views.project_detail', args=(A('pk'),))
issue_date = tables.DateColumn(format=DEFAULT_DATE_FORMAT)
start_date = tables.DateColumn(format=DEFAULT_DATE_FORMAT)
state = tables.Column(verbose_name="Status")
members_count = tables.Column(verbose_name=_("Enrolled"), default=0,
sortable=False)
membership_status = tables.Column(verbose_name=_("My status"), empty_values=(),
......@@ -197,13 +196,16 @@ class UserProjectApplicationsTable(tables.Table):
sortable=False)
def render_membership_status(self, *args, **kwargs):
return MEMBER_STATUS_DISPLAY.get(kwargs.get('record').user_status(self.user))
def render_membership_status(self, record, *args, **kwargs):
status = record.user_status(self.user)
if status == 100:
return record.state
else:
return MEMBER_STATUS_DISPLAY.get(status, 'Unknown')
class Meta:
model = ProjectApplication
fields = ('name', 'membership_status', 'issue_date', 'start_date',
'state', 'members_count')
fields = ('name', 'membership_status', 'issue_date', 'start_date', 'members_count')
attrs = {'id': 'projects-list', 'class': 'my-projects alt-style'}
caption = _('My projects')
template = "im/table_render.html"
......
......@@ -1111,7 +1111,7 @@ def project_list(request):
projects = ProjectApplication.objects.user_projects(request.user).select_related()
table = tables.UserProjectApplicationsTable(projects, user=request.user,
prefix="my_projects_")
RequestConfig(request).configure(table)
RequestConfig(request, paginate={"per_page": PAGINATE_BY}).configure(table)
return object_list(
request,
......@@ -1193,7 +1193,7 @@ def project_detail(request, application_id):
members = application.project.projectmembership_set.select_related()
members_table = tables.ProjectApplicationMembersTable(members,
prefix="members_")
RequestConfig(request).configure(members_table)
RequestConfig(request, paginate={"per_page": PAGINATE_BY}).configure(members_table)
try:
return object_detail(
......@@ -1238,7 +1238,7 @@ def project_search(request):
table = tables.UserProjectApplicationsTable(projects, user=request.user,
prefix="my_projects_")
RequestConfig(request).configure(table)
RequestConfig(request, paginate={"per_page": PAGINATE_BY}).configure(table)
return object_list(
request,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment