from django.core import serializers
from django.http.response import HttpResponse

from what_meta.models import WhatTorrentGroup


def search_torrent_groups(request, query):
    return HttpResponse(
        serializers.serialize('json', WhatTorrentGroup.objects.filter(name__icontains=query)),
        content_type='text/plain',
    )

from django.core import serializers
from django.http.response import HttpResponse

from what_meta.models import WhatTorrentGroup


def search_torrent_groups(request, query):
    response = HttpResponse(
        serializers.serialize('json', WhatTorrentGroup.objects.filter(name__icontains=query)),
        content_type='text/json',
    )
    response['Access-Control-Allow-Origin'] = '*'
    return response

Support for super simple player.
Support for super simple player.

  from django.core import serializers
  from django.http.response import HttpResponse
  
  from what_meta.models import WhatTorrentGroup
  
  
  def search_torrent_groups(request, query):
-     return HttpResponse(
+     response = HttpResponse(
          serializers.serialize('json', WhatTorrentGroup.objects.filter(name__icontains=query)),
-         content_type='text/plain',
+         content_type='text/json',
      )
+     response['Access-Control-Allow-Origin'] = '*'
+     return response
  
Support for super simple player.
## Code Before:
from django.core import serializers
from django.http.response import HttpResponse

from what_meta.models import WhatTorrentGroup


def search_torrent_groups(request, query):
    return HttpResponse(
        serializers.serialize('json', WhatTorrentGroup.objects.filter(name__icontains=query)),
        content_type='text/plain',
    )

## Instruction:
Support for super simple player.
## Code After:
from django.core import serializers
from django.http.response import HttpResponse

from what_meta.models import WhatTorrentGroup


def search_torrent_groups(request, query):
    response = HttpResponse(
        serializers.serialize('json', WhatTorrentGroup.objects.filter(name__icontains=query)),
        content_type='text/json',
    )
    response['Access-Control-Allow-Origin'] = '*'
    return response
