forked from mirrors/bookwyrm
Uses template for generating goal status
This commit is contained in:
parent
0df7be6cfc
commit
2297fe133d
2 changed files with 4 additions and 1 deletions
1
bookwyrm/templates/snippets/generated_status/goal.html
Normal file
1
bookwyrm/templates/snippets/generated_status/goal.html
Normal file
|
@ -0,0 +1 @@
|
|||
{% load humanize %}set a goal to read {{ goal.goal | intcomma }} book{{ goal.goal | pluralize }} in {{ goal.year }}
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue