Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hypha/apply/projects/reports/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def save(self, commit=True, form_fields=dict):
# If this is the first submission of the report we track that as the
# submitted date of the report
if not instance.submitted:
instance.author = self.user
instance.submitted = version.submitted
instance.current = version
instance.draft = None
Expand Down
25 changes: 25 additions & 0 deletions hypha/apply/projects/reports/migrations/0002_report_author.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.22 on 2025-06-17 14:27

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("project_reports", "0001_initial"),
]

operations = [
migrations.AddField(
model_name="report",
name="author",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="owned_reports",
to=settings.AUTH_USER_MODEL,
),
),
]
6 changes: 6 additions & 0 deletions hypha/apply/projects/reports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ class Report(BaseStreamForm, AccessFormData, models.Model):
project = models.ForeignKey(
"application_projects.Project", on_delete=models.CASCADE, related_name="reports"
)
author = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.SET_NULL,
null=True,
related_name="owned_reports",
)
form_fields = StreamField(
# Re-use the Project Custom Form class. The original fields (used at the time of response) should be required.
ProjectFormCustomFormFieldsBlock(),
Expand Down
31 changes: 29 additions & 2 deletions hypha/apply/projects/reports/templates/reports/report_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,34 @@

{% block content %}
<div class="my-4 wrapper wrapper--sidebar">
<div class="grow">
<article class="grow">
<div class="flex gap-x-4 mb-4 text-xs text-fg-muted">
<span>
{% trans "Submitted " %}
<strong class="font-semibold">
<relative-time datetime={{ object.submitted|date:"c" }}>
{{ object.submitted|date:"SHORT_DATETIME_FORMAT" }}
</relative-time>
</strong>
{% trans "by" %}
<strong class="font-semibold">
{{ object.author }}
</strong>
</span>
<span>
{% trans "Updated" %}
<strong class="font-semibold">
<relative-time datetime={{ object.current.submitted|date:"c" }}>
{{ object.current.submitted|date:"SHORT_DATETIME_FORMAT" }}
</relative-time>
</strong>
{% trans "by" %}
<strong class="font-semibold">
{{ object.current.author }}
</strong>
</span>
</div>

<div role="alert" class="mb-4 alert alert-info">
{% heroicon_outline 'exclamation-circle' stroke_width=2 size=18 aria_hidden=true %}
<span>
Expand Down Expand Up @@ -52,7 +79,7 @@ <h4>{% trans "Attachments" %}</h4>
{% endfor %}
{% endif %}
</section>
</div>
</article>
<aside class="sidebar">
{% if request.user.is_apply_staff or report.previous or report.next %}
<div class="card card-border shadow-xs">
Expand Down
Loading