Ticket #104 (closed defect: worksforme)

Opened 7 years ago

Last modified 7 years ago

fk to subclass of user misses the user model

Reported by: anonymous Owned by: andrew
Priority: major Milestone: 0.5
Component: commands Version: 0.6-pre
Keywords: Cc:


When adding a model (--model AdditionalPage?) which has a foreign key to a subclass of auth.User (adminuser in my example), the migration fails with:

ValueError?: Cannot successfully create field 'user_ptr' for model 'adminuser': name 'User' is not defined.

due to the following in models:

'app_name.adminuser': {

'Meta': {'_bases': django.contrib.auth.models.User?},
'_stub': True,
'user_ptr': ('models.OneToOneField?', User?, {})


adding auth.user to models makes the migration work:

'auth.user': {

'_stub': True,
'id': ('models.AutoField?', [], {'primary_key': 'True'})


Change History

comment:1 Changed 7 years ago by andrew

  • Status changed from new to assigned
  • Version set to subversion
  • Milestone set to 0.5

comment:2 Changed 7 years ago by andrew

  • Status changed from assigned to closed
  • Resolution set to worksforme

I can't replicate this; here, it correctly freezes User, and the migration works. Try updating to the newest trunk, and try again; if it still happens, reopen this ticket and attach either the models.py that makes it fail or one sufficiently anonymised so it gets round whatever NDA you have :)

Note: See TracTickets for help on using tickets.