I still can't log in. Sometimes I get a dialogue box, sometimes a form, but it just never works. My username is Friendless. Anyway, as I have your permission to post my bug here, I'll do so. I have a legacy MySQL database to which I'm adding access using Django. I wrote the create scripts for this db by hand while I was learning MySQL so they're "quirky". I ran inspectdb and it failed like this:
Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) File "/usr/lib/python2.5/site-packages/django/core/management/ __init__.py", line 340, in execute_manager utility.execute() File "/usr/lib/python2.5/site-packages/django/core/management/ __init__.py", line 295, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python2.5/site-packages/django/core/management/ base.py", line 192, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/lib/python2.5/site-packages/django/core/management/ base.py", line 219, in execute output = self.handle(*args, **options) File "/usr/lib/python2.5/site-packages/django/core/management/ base.py", line 348, in handle return self.handle_noargs(**options) File "/usr/lib/python2.5/site-packages/django/core/management/ commands/inspectdb.py", line 10, in handle_noargs for line in self.handle_inspection(): File "/usr/lib/python2.5/site-packages/django/core/management/ commands/inspectdb.py", line 36, in handle_inspection relations = connection.introspection.get_relations(cursor, table_name) File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/ introspection.py", line 80, in get_relations other_field_index = self._name_to_index(cursor, other_table) [other_field] KeyError: u'BGGID' i.e. it can't find the column that I have a foreign key constraint on. The tables in question are: CREATE TABLE `expansions` ( `basegame` int(10) unsigned NOT NULL, `expansion` int(10) unsigned NOT NULL, KEY `expansions_basegame` (`basegame`), KEY `expansions_expansion` (`expansion`), CONSTRAINT `expansions_basegame` FOREIGN KEY (`basegame`) REFERENCES `games` (`BGGID`), CONSTRAINT `expansions_expansion` FOREIGN KEY (`expansion`) REFERENCES `games` (`BGGID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CREATE TABLE `games` ( `bggid` int(10) unsigned NOT NULL, `name` varchar(256) NOT NULL default '', `average` float default '0', `rank` int(11) default '-1', `yearPublished` int(11) default '0', `minPlayers` int(10) unsigned default '0', `maxPlayers` int(10) unsigned default '0', `playTime` int(10) unsigned default '0', `usersRated` int(10) unsigned default '0', `usersTrading` int(10) unsigned default '0', `usersWanting` int(10) unsigned default '0', `usersWishing` int(10) unsigned default '0', `averageWeight` float default '0', `bayesAverage` float default '0', `stdDev` float default '0', `median` float default '0', `numComments` int(10) unsigned default '0', `expansion` int(10) unsigned NOT NULL default '0', `thumbnail` varchar(256) default '', `usersOwned` int(10) unsigned default '0', PRIMARY KEY (`bggid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 Note that in the first table the column name is BGGID and in the second it's bggid. I always presumed this worked as MySQL doesn't complain, and I hope it would if I defined a constraint that made no sense. Anyway, I hacked the code in introspection.py. I changed line 80 to this: other_field_index = self._name_to_index(cursor, other_table) [other_field.lower()] i.e. I just added the .lower(), and it works for me, and then inspectdb worked fine. Anyway, the problem is that inspectdb fails due to case quirks, and with a completely unhelpful error message. It would be so much nicer if it either figured out for itself (which it should do if the case difference is a valid thing to do), or else give a better error message. Anyway, after sorting that out I went on to try to access a table with no primary key, and discovered that didn't work either :-). I also managed to hack around that. Despite the problems I'm really enjoying Django and think I will keep using it. John On Jan 3, 12:04 am, "Karen Tracey" <kmtra...@gmail.com> wrote: > On Fri, Jan 2, 2009 at 5:03 AM, Friendless > <friendless.farr...@gmail.com>wrote: > > > > > I tried to report a bug anonymously and got told I was spam, so I > > signed up, got the email, activated the account, and still can't log > > in and still can't report the bug. I've been using Django 30 minutes > > and I'm already frustrated! > > This is the first report I've ever seen of trouble with logging in after > creating an account, so I'm not sure what's wrong there. An alternative way > to avoid the spam blocker is to just fill in some settings here: > > http://code.djangoproject.com/settings > > If you've only been using Django for 30 minutes, though, it might be more > useful to post your problem here. 30 minutes in you are far more likely to > be hitting user misunderstandings than genuine bugs, and the list is a much > better place for help with those. > > Karen --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---