diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-12-12 20:24:30 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-12-12 20:24:30 -0500 |
commit | f9ae4f860ccf57e84032d7be9426331a9e06e979 (patch) | |
tree | c9d837d7e2750d22ba9049abc7cf3c4125f0c9e4 /main/fields.py | |
parent | 6c5c3355a97d35afb7f1eee284966ad0bf8cee3b (diff) | |
parent | 206000df736fde75a49c3178a8522d17f30a955e (diff) |
Merge tag 'release_2012-04-21'
Migrations, moving code around, random small improvements
Diffstat (limited to 'main/fields.py')
-rw-r--r-- | main/fields.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/main/fields.py b/main/fields.py index 948cb5d9..2d5703ef 100644 --- a/main/fields.py +++ b/main/fields.py @@ -1,5 +1,4 @@ from django.db import models -from django.core.validators import RegexValidator class PositiveBigIntegerField(models.BigIntegerField): @@ -13,30 +12,4 @@ class PositiveBigIntegerField(models.BigIntegerField): defaults.update(kwargs) return super(PositiveBigIntegerField, self).formfield(**defaults) -class PGPKeyField(models.CharField): - _south_introspects = True - - def __init__(self, *args, **kwargs): - super(PGPKeyField, self).__init__(*args, **kwargs) - self.validators.append(RegexValidator(r'^[0-9A-F]{40}$', - "Ensure this value consists of 40 hex characters.", 'hex_char')) - - def to_python(self, value): - if value == '' or value is None: - return None - value = super(PGPKeyField, self).to_python(value) - # remove all spaces - value = value.replace(' ', '') - # prune prefixes, either 0x or 2048R/ type - if value.startswith('0x'): - value = value[2:] - value = value.split('/')[-1] - # make all (hex letters) uppercase - return value.upper() - - def formfield(self, **kwargs): - # override so we don't set max_length form field attribute - return models.Field.formfield(self, **kwargs) - - # vim: set ts=4 sw=4 et: |