﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6556	Custom subclass of models.CharField does not appear in the CREATE SQL	 	nobody	"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"")
}}}"		closed	Database layer (models, ORM)	dev		fixed			Unreviewed	0	0	0	0	0	0
