code: def to_url(self, obj):
          
          level_name = getattr(obj, 'level_name', None)
          if not level_name:
              raise ValueError('Unable to serialize "%s" to url' % obj)
  
          code = getattr(obj, 'code', None)
          slug = getattr(obj, 'slug', None)
          validity = getattr(obj, 'validity', None)
          if code and slug:
              return '{level_name}/{code}@{start_date}/{slug}'.format(
                  level_name=level_name,
                  code=code,
                  start_date=getattr(validity, 'start', None) or 'latest',
                  slug=slug
              )
          else:
              raise ValueError('Unable to serialize "%s" to url' % obj)
docs: Reconstruct the URL from level name, code or datagouv id and slug.