Пример #1
0
def serialize_mission_affectation(mission_affectation):
	"""
	Serialize a mission affectation to JSON.
	"""
	r = serialize_folk_min(mission_affectation.folk)
	r['id'] = mission_affectation.pk
	
	r.update({'links': {
		'defect': reverse('mission.views.pending_mission_grid_defect', args=(mission_affectation.pk, ))
	}})

	return r
Пример #2
0
def serialize_available_title(available_title):
	"""
	Serialize an available title object to JSON.
	"""

	r = {
		'id': available_title.id,
		'title_id': available_title.title_id,
		'name': available_title.title.name,
		'description': available_title.title.description,
		'folk': serialize_folk_min(available_title.folk) if available_title.folk is not None else None,
		'links': {
			'affect': reverse('title.views.available_title_affect', args=(available_title.pk,)),
			'defect': reverse('title.views.available_title_defect', args=(available_title.pk,))
		}
	}

	return r