summaryrefslogtreecommitdiff
path: root/main/fields.py
blob: 534947727ab107fc6447bbe2c4e2094c74067dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
from django.db import models


class PositiveBigIntegerField(models.BigIntegerField):
    def get_internal_type(self):
        return "BigIntegerField"

    def formfield(self, **kwargs):
        defaults = { 'min_value': 0 }
        defaults.update(kwargs)
        return super(PositiveBigIntegerField, self).formfield(**defaults)

# vim: set ts=4 sw=4 et: