Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from nnsnodnb/master
PositiveBigIntegerField
- Loading branch information
Showing
5 changed files
with
67 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from django.db.models import BigIntegerField | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class PositiveBigIntegerField(BigIntegerField): | ||
|
||
empty_strings_allowed = False | ||
description = _('Big (8 byte) positive integer') | ||
|
||
def db_type(self, connection): | ||
return 'bigint UNSIGNED' | ||
|
||
def get_internal_type(self): | ||
return 'PositiveSmallIntegerField' | ||
|
||
def formfield(self, **kwargs): | ||
defaults = { | ||
'min_value': 0, | ||
'max_value': BigIntegerField.MAX_BIGINT | ||
} | ||
defaults.update(kwargs) | ||
return super(PositiveBigIntegerField, self).formfield(**defaults) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 2.0.4 on 2018-06-09 16:54 | ||
|
||
from django.db import migrations | ||
import storekit.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('storekit', '0004_auto_20180605_1629'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='inapp', | ||
name='original_transaction_id', | ||
field=storekit.fields.PositiveBigIntegerField(blank=True), | ||
), | ||
migrations.AlterField( | ||
model_name='inapp', | ||
name='transaction_id', | ||
field=storekit.fields.PositiveBigIntegerField(blank=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters