from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db import models
from django.template.loader import render_to_string
+from django.utils.encoding import force_unicode
from django.utils.translation import ugettext_lazy as _
from dvcs.models import Ref
from organizations.models import Organization
self.assigned_to = None
self.save()
+ def stage_name(self):
+ return force_unicode(dict(STAGES)[self.stage]) if self.stage else None
+
def get_plan(self):
try:
plan = self.plan_set.get(stage=self.stage)
title: '{% trans 'Informations about lesson' %}',
properties: [
{name: 'version', label: '{% trans 'Version' %}'},
- {name: 'stage', label: '{% trans 'Stage' %}'},
+ {name: 'stage_name', label: '{% trans 'Stage' %}'},
{name: 'assignment', label: '{% trans 'Assignment' %}'},
]
},
'version': len(history),
'revision': revision.pk,
'stage': doc.stage,
+ 'stage_name': doc.stage_name(),
'assignment': str(doc.assigned_to),
}),
'serialized_templates': json.dumps([
return JSONResponse({
'text': None, # doc.materialize() if parent_revision != revision else None,
# 'version': revision,
- # 'stage': doc.stage.name if doc.stage else None,
+ 'stage': doc.stage,
+ 'stage_name': doc.stage_name(),
'assignment': doc.assigned_to.username if doc.assigned_to else None
})
else: