diff --git a/opentech/apply/activity/templates/activity/include/activity_list.html b/opentech/apply/activity/templates/activity/include/activity_list.html new file mode 100644 index 0000000000000000000000000000000000000000..07494662fb9370deaf843619ed04f2331ac3562d --- /dev/null +++ b/opentech/apply/activity/templates/activity/include/activity_list.html @@ -0,0 +1,7 @@ +{% for event in activity %} +<div> + <p>{{ event.timestamp }}</p> + <p>{{ event.user }}</p> + <p>{{ event.message }}</p> +</div> +{% endfor %} diff --git a/opentech/apply/activity/views.py b/opentech/apply/activity/views.py index f7a15a82e759b1202d1a4fad9d862a235e02b350..124df88ac99cace721d451cddfea256fdd1bb49b 100644 --- a/opentech/apply/activity/views.py +++ b/opentech/apply/activity/views.py @@ -4,9 +4,10 @@ from .forms import CommentForm from .models import Activity, COMMENT -class CommentContextMixin: +class ActivityContextMixin: def get_context_data(self, **kwargs): extra = { + 'activity': Activity.activities.filter(submission=self.object), 'comments': Activity.comments.filter(submission=self.object), CommentFormView.context_name: CommentFormView.form_class(), } @@ -38,4 +39,4 @@ class CommentFormView(DelegatedViewMixin, CreateView): return super().form_valid(form) def get_success_url(self): - return self.object.application.get_absolute_url() + return self.object.submission.get_absolute_url() diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_detail.html b/opentech/apply/funds/templates/funds/applicationsubmission_detail.html index 4ffd19992051ee78bb4081810bfc84105311e037..d9ddb50cb941027f9694648e542ba83700c997a4 100644 --- a/opentech/apply/funds/templates/funds/applicationsubmission_detail.html +++ b/opentech/apply/funds/templates/funds/applicationsubmission_detail.html @@ -62,6 +62,7 @@ {% endif %} {% include "activity/include/comment_form.html" %} {% include "activity/include/comment_list.html" %} + {% include "activity/include/activity_list.html" %} </aside> </div> </div> diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py index 1158689b50a0411ddb40fdfdf5eb58557b5fc024..a43b32b9246a644e8cf425e5ab77b39809bc32d4 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -5,7 +5,7 @@ from django.views.generic import DetailView, UpdateView from django_filters.views import FilterView from django_tables2.views import SingleTableMixin -from opentech.apply.activity.views import CommentContextMixin, CommentFormView, DelegatedViewMixin +from opentech.apply.activity.views import ActivityContextMixin, CommentFormView, DelegatedViewMixin from opentech.apply.activity.models import Activity from .forms import ProgressSubmissionForm @@ -70,7 +70,7 @@ class ProgressSubmissionView(DelegatedViewMixin, UpdateView): return response -class SubmissionDetailView(CommentContextMixin, ProgressContextMixin, DetailView): +class SubmissionDetailView(ActivityContextMixin, ProgressContextMixin, DetailView): model = ApplicationSubmission form_views = { 'progress': ProgressSubmissionView,