1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.db import models
8 class SlugNullField(models.SlugField):
9 description = "SlugField that stores NULL instead of blank value."
11 def to_python(self, value):
12 value = super(SlugNullField, self).to_python(value)
13 return value if value is not None else u""
15 def get_prep_value(self, value, **kwargs):
16 value = super(SlugNullField, self).get_prep_value(value)
22 from south.modelsinspector import add_introspection_rules
26 add_introspection_rules([], ["^migdal\.fields\.SlugNullField"])