You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

serializers.py 435B

12345678910
  1. from django.db.migrations.serializer import BaseSerializer
  2. class RangeSerializer(BaseSerializer):
  3. def serialize(self):
  4. module = self.value.__class__.__module__
  5. # Ranges are implemented in psycopg2._range but the public import
  6. # location is psycopg2.extras.
  7. module = 'psycopg2.extras' if module == 'psycopg2._range' else module
  8. return '%s.%r' % (module, self.value), {'import %s' % module}