Source

django-tsearch2 / tsearch2 / fields.py

Full commit
from django.db import models


class VectorField(models.Field):
    def __init__(self, *args, **kwargs):
        kwargs['null'] = True
        kwargs['blank'] = True
        kwargs['editable'] = False
        kwargs['serialize'] = False
        super(VectorField, self).__init__(*args, **kwargs)
    
    def db_type(self):
        return 'tsvector'

    def contribute_to_class(self, cls, name):
        super(VectorField, self).contribute_to_class(cls, name)

        # Make this object the descriptor for field access.
        setattr(cls, cls._meta.tsvector_field_name, self)