Skip to content

Commit

Permalink
add project PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
florianm committed Oct 16, 2017
1 parent 12e66d1 commit 8541381
Show file tree
Hide file tree
Showing 6 changed files with 370 additions and 78 deletions.
6 changes: 2 additions & 4 deletions pythia/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ def get_readonly_fields(self, request, obj=None):
the correct project.
User is read-only when changing, but can be set during adding.
This enables
"""
rof = super(ProjectMembershipAdmin, self).get_readonly_fields(request,
obj)
Expand All @@ -97,7 +94,7 @@ def get_readonly_fields(self, request, obj=None):
# return result


class ProjectAdmin(BaseAdmin):
class ProjectAdmin(BaseAdmin, DownloadAdminMixin):
list_display = ('project_id', 'type', 'year', 'number', 'project_title',
'project_owner_name', 'program', 'research_function',
'status', 'fm_start_date', 'fm_end_date')
Expand All @@ -106,6 +103,7 @@ class ProjectAdmin(BaseAdmin):
list_display_links = ('project_id', 'project_title')
search_fields = ('title', 'year', 'number')
list_filter = ('type', 'program', 'status')
download_template = "project_showcase"

def get_fieldsets(self, request, obj=None):
# print("project admin get fieldsets")
Expand Down
12 changes: 12 additions & 0 deletions pythia/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,18 @@ def status_display(self):
def absolute_url(self):
"""Return the absolute url."""
return self.get_absolute_url()
# -------------------------------------------------------------------------#
# Print
#
@property
def download_title(self):
"""The PDF title."""
return 'Project'

@property
def download_subtitle(self):
"""The PDF subtitle."""
return self.fullname

# -------------------------------------------------------------------------#
# Team members
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
{% endif %}
{% endblock %}

{% block object-tools-download %}
<li class="pull-right">
<a href="download/pdf"
target="_"
title="View PDF in new tab">View PDF</a>
</li>
{% endblock %}


<!-- Project details, read-only, custom layout -->
{% block shinythings %}
Expand Down
Loading

0 comments on commit 8541381

Please sign in to comment.