Merge pull request #619 from mouse-reeve/goal-status-template
Uses template for generating goal status
This commit is contained in:
commit
c702e92b7d
|
@ -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.contrib.auth.decorators import login_required
|
||||||
from django.http import HttpResponseNotFound
|
from django.http import HttpResponseNotFound
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
from django.template.loader import get_template
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
@ -62,9 +63,10 @@ class Goal(View):
|
||||||
|
|
||||||
if request.POST.get('post-status'):
|
if request.POST.get('post-status'):
|
||||||
# create status, if appropraite
|
# create status, if appropraite
|
||||||
|
template = get_template('snippets/generated_status/goal.html')
|
||||||
create_generated_note(
|
create_generated_note(
|
||||||
request.user,
|
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
|
privacy=goal.privacy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue