If I subclass models.CharField? (without overwriting anything) it seems to work perfectly but the field is not created on syncdb anymore. Explicitly defining get_internal_type() fixes this.
That's the field (working)
class Event(models.Model):
urania_event_id = models.CharField("foo", max_length=4, unique_for_year="time")
Subclassed without changing anything.
class UraniaEventID(models.CharField):
pass
class Event(models.Model):
urania_event_id = UraniaEventID("foo", max_length=4, unique_for_year="time")
Effect: 'urania_event_id' does not appear in CREATE SQL anymore
Workaround:
class UraniaEventID(models.CharField):
def get_internal_type(self):
return "CharField"
class Event(models.Model):
urania_event_id = UraniaEventID("foo", max_length=4, unique_for_year="time")