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


class PositiveBigIntegerField(models.BigIntegerField):
    _south_introspects = True

    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: