from django.middleware.gzip import GZipMiddleware
from django.utils.decorators import decorator_from_middleware
from django.utils.encoding import smart_unicode
+from django.utils.formats import localize
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST, require_GET
from django.views.generic.simple import direct_to_template
"text_revert": forms.DocumentTextRevertForm(prefix="textrevert"),
"pubmark": forms.DocumentPubmarkForm(prefix="pubmark"),
},
+ 'can_pubmark': request.user.has_perm('catalogue.can_pubmark'),
'REDMINE_URL': settings.REDMINE_URL,
})
parent = None
stage = form.cleaned_data['stage_completed']
tags = [stage] if stage else []
+ publishable = (form.cleaned_data['publishable'] and
+ request.user.has_perm('catalogue.can_pubmark'))
doc.commit(author=author,
text=text,
parent=parent,
tags=tags,
author_name=form.cleaned_data['author_name'],
author_email=form.cleaned_data['author_email'],
+ publishable=publishable,
)
revision = doc.revision()
return JSONResponse({
return HttpResponseForbidden("Not authorized.")
changes = []
- for change in doc.history().order_by('-created_at'):
+ for change in doc.history().reverse():
changes.append({
"version": change.revision,
"description": change.description,
"author": change.author_str(),
- "date": change.created_at,
+ "date": localize(change.created_at),
"publishable": _("Publishable") + "\n" if change.publishable else "",
"tag": ',\n'.join(unicode(tag) for tag in change.tags.all()),
})