# Path: hashid_field/field.py
# class HashidField(HashidFieldMixin, HashidCharFieldMixin, models.IntegerField):
#     description = "A Hashids obscured IntegerField"
# 
# class BigHashidField(HashidFieldMixin, HashidCharFieldMixin, models.BigIntegerField):
#     description = "A Hashids obscured BigIntegerField"
# 
#     def __init__(self, min_length=settings.HASHID_FIELD_BIG_MIN_LENGTH, *args, **kwargs):
#         super().__init__(min_length=min_length, *args, **kwargs)
# 
# class HashidAutoField(HashidFieldMixin, models.AutoField):
#     description = "A Hashids obscured AutoField"
# 
# class BigHashidAutoField(HashidFieldMixin, models.AutoField):
#     # This inherits from AutoField instead of BigAutoField so that DEFAULT_AUTO_FIELD doesn't throw an error
#     description = "A Hashids obscured BigAutoField"
# 
#     def get_internal_type(self):
#         return 'BigAutoField'
# 
#     def rel_db_type(self, connection):
#         return models.BigIntegerField().db_type(connection=connection)
# 
#     def __init__(self, min_length=settings.HASHID_FIELD_BIG_MIN_LENGTH, *args, **kwargs):
#         super().__init__(min_length=min_length, *args, **kwargs)


from django.db import models
from hashid_field import HashidField, BigHashidField, HashidAutoField, BigHashidAutoField
    name = models.CharField(max_length=40)

    def __str__(self):
        return "{} ({})".format(self.name, self.id)


class Record(models.Model):
    id = BigHashidAutoField(primary_key=True)
    name = models.CharField(max_length=40)
    artist = models.ForeignKey(Artist, on_delete=models.CASCADE, null=True, blank=True, related_name="records")
    reference_id = HashidField()
    prefixed_id = HashidField(null=True, blank=True, prefix="prefix_")
    string_id = HashidField(null=True, blank=True, enable_hashid_object=False)
    plain_hashid = HashidField(null=True, blank=True, enable_descriptor=False)
    plain_id = HashidField(null=True, blank=True, enable_descriptor=False, enable_hashid_object=False)
    alternate_id = HashidField(salt="a different salt", null=True, blank=True)
    key = BigHashidField(min_length=10, alphabet="abcdlmnotuvwxyz123789", null=True, blank=True)

    def __str__(self):
        return "{} ({})".format(self.name, self.reference_id)


class Track(models.Model):
    id = BigHashidAutoField(primary_key=True, allow_int_lookup=True, min_length=10, prefix='albumtrack:', salt="abcd", alphabet="abcdefghijklmnop")


class RecordLabel(models.Model):
    def name_prefix(model_class, **kw):
        return model_class._meta.verbose_name.replace(' ', '_') + '/'


# Path: hashid_field/field.py
# class HashidField(HashidFieldMixin, HashidCharFieldMixin, models.IntegerField):
#     description = "A Hashids obscured IntegerField"
# 
# class BigHashidField(HashidFieldMixin, HashidCharFieldMixin, models.BigIntegerField):
#     description = "A Hashids obscured BigIntegerField"
# 
#     def __init__(self, min_length=settings.HASHID_FIELD_BIG_MIN_LENGTH, *args, **kwargs):
#         super().__init__(min_length=min_length, *args, **kwargs)
# 
# class HashidAutoField(HashidFieldMixin, models.AutoField):
#     description = "A Hashids obscured AutoField"
# 
# class BigHashidAutoField(HashidFieldMixin, models.AutoField):
#     # This inherits from AutoField instead of BigAutoField so that DEFAULT_AUTO_FIELD doesn't throw an error
#     description = "A Hashids obscured BigAutoField"
# 
#     def get_internal_type(self):
#         return 'BigAutoField'
# 
#     def rel_db_type(self, connection):
#         return models.BigIntegerField().db_type(connection=connection)
# 
#     def __init__(self, min_length=settings.HASHID_FIELD_BIG_MIN_LENGTH, *args, **kwargs):
#         super().__init__(min_length=min_length, *args, **kwargs)


# Path: tests/models.py
from django.db import models
from hashid_field import HashidField, BigHashidField, HashidAutoField, BigHashidAutoField

    name = models.CharField(max_length=40)

    def __str__(self):
        return "{} ({})".format(self.name, self.id)


class Record(models.Model):
    id = BigHashidAutoField(primary_key=True)
    name = models.CharField(max_length=40)
    artist = models.ForeignKey(Artist, on_delete=models.CASCADE, null=True, blank=True, related_name="records")
    reference_id = HashidField()
    prefixed_id = HashidField(null=True, blank=True, prefix="prefix_")
    string_id = HashidField(null=True, blank=True, enable_hashid_object=False)
    plain_hashid = HashidField(null=True, blank=True, enable_descriptor=False)
    plain_id = HashidField(null=True, blank=True, enable_descriptor=False, enable_hashid_object=False)
    alternate_id = HashidField(salt="a different salt", null=True, blank=True)
    key = BigHashidField(min_length=10, alphabet="abcdlmnotuvwxyz123789", null=True, blank=True)

    def __str__(self):
        return "{} ({})".format(self.name, self.reference_id)


class Track(models.Model):
    id = BigHashidAutoField(primary_key=True, allow_int_lookup=True, min_length=10, prefix='albumtrack:', salt="abcd", alphabet="abcdefghijklmnop")


class RecordLabel(models.Model):
    def name_prefix(model_class, **kw):
        return model_class._meta.verbose_name.replace(' ', '_') + '/'


    id = HashidAutoField(primary_key=True, allow_int_lookup=True, prefix=name_prefix)