Joe, On Thu, 2006-07-20 at 11:41 +1000, Malcolm Tredinnick wrote: > On Wed, 2006-07-19 at 21:25 -0400, Joe wrote: [...] > > The database uses the CHAR(n) (or CHARACTER(n)) datatype in several > > places, i.e., a fixed length character type, typically for very short > > "code" type columns. inspectdb also mapped those to TextFields > > indicating it was a guess. Can I remap them to CharField(maxlength=n) > > or will that have unintended side-effects (and why is inspectdb unaware > > of CHAR types?). > > The important characterstic of CHAR that you forgot to mention was that > it is blank padded on the right, so that it's length is always "n". > CharField maps to a VARCHAR (not blank padded). There is no equivalent > to blank-padded fields in Django. Up to you how you wish to resolve that > one.
Thinking about this one a bit more, I think you'll be mostly fine. The type of the field is relatively unimportant by the time it comes to doing queries and updates (after all, the database does the blank padding -- you don't need to supply it at insert/update time). The main weirdness you will see is that returned strings will be right padded and these default values will appear in any HTML input fields you use the field value in. I'm not completely sure if the flow-on effects of that will get in your way or not (you will certainly get a bunch of spaces passed around, but that may end up being transparent). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---