old_contents: # -*- coding: utf-8 -*-
  from __future__ import unicode_literals
  
  import json
  
  from rest_framework import serializers
  
  from catalog.models import Course, Category
  
  
  class CourseSerializer(serializers.HyperlinkedModelSerializer):
      meta = serializers.SerializerMethodField()
  
      def get_meta(self, course):
          return json.loads(course.description)
  
      class Meta:
          model = Course
          fields = (
              'id', 'name', 'slug', 'url', 'meta',
              'categories', 'document_set', 'thread_set'
          )
  
          extra_kwargs = {
              'url': {'lookup_field': 'slug'}
          }
  
  
  class ShortCourseSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Course
          fields = ('id', 'url', 'slug', 'name', )
  
          extra_kwargs = {
              'url': {'lookup_field': 'slug'}
          }
  
  
  class CategorySerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Category
          fields = ('id', 'url', 'slug', 'name', 'parent', 'children', 'course_set')
  
          extra_kwargs = {
              'course_set': {'lookup_field': 'slug'},
          }
  
  
  class ShortCategorySerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Category
          fields = ('id', 'url', 'slug', 'name', )
  
new_contents: # -*- coding: utf-8 -*-
  from __future__ import unicode_literals
  
  import json
  
  from rest_framework import serializers
  
  from catalog.models import Course, Category
  
  
  class CourseSerializer(serializers.HyperlinkedModelSerializer):
      meta = serializers.SerializerMethodField()
  
      class Meta:
          model = Course
          fields = (
              'id', 'name', 'slug', 'url'
              'categories', 'document_set', 'thread_set'
          )
  
          extra_kwargs = {
              'url': {'lookup_field': 'slug'}
          }
  
  
  class ShortCourseSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Course
          fields = ('id', 'url', 'slug', 'name', )
  
          extra_kwargs = {
              'url': {'lookup_field': 'slug'}
          }
  
  
  class CategorySerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Category
          fields = ('id', 'url', 'slug', 'name', 'parent', 'children', 'course_set')
  
          extra_kwargs = {
              'course_set': {'lookup_field': 'slug'},
          }
  
  
  class ShortCategorySerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Category
          fields = ('id', 'url', 'slug', 'name', )
  
subject: Fix 500 on /api/courses/*