diff --git a/bookwyrm/templates/snippets/generated_status/goal.html b/bookwyrm/templates/snippets/generated_status/goal.html new file mode 100644 index 00000000..3b4d0de4 --- /dev/null +++ b/bookwyrm/templates/snippets/generated_status/goal.html @@ -0,0 +1 @@ +{% load humanize %}set a goal to read {{ goal.goal | intcomma }} book{{ goal.goal | pluralize }} in {{ goal.year }} diff --git a/bookwyrm/views/goal.py b/bookwyrm/views/goal.py index 87404b10..4f2d1b6f 100644 --- a/bookwyrm/views/goal.py +++ b/bookwyrm/views/goal.py @@ -2,6 +2,7 @@ from django.contrib.auth.decorators import login_required from django.http import HttpResponseNotFound from django.shortcuts import redirect +from django.template.loader import get_template from django.template.response import TemplateResponse from django.utils.decorators import method_decorator from django.views import View @@ -62,9 +63,10 @@ class Goal(View): if request.POST.get('post-status'): # create status, if appropraite + template = get_template('snippets/generated_status/goal.html') create_generated_note( request.user, - 'set a goal to read %d books in %d' % (goal.goal, goal.year), + template.render({'goal': goal, 'user': request.user}).strip(), privacy=goal.privacy )