anyone to help me on this? thanks james
On Jul 19, 3:20 pm, james_027 <[EMAIL PROTECTED]> wrote: > Hi Nathan, > > I did manage.py syncdb with the table still not existing. I did > manage.py sqlall myapps when saw that the foreign key was not created. > > here is my actual source code. > > from django.db import models > from django.contrib.auth.models import User as AdminUser > > # Create your models here. > DEPARTMENTS = ( > ('HRD', 'HRD'), > ('ACT', 'Accounting'), > ('PUR', 'Purchasing'), > ('LOG', 'Logistics'), > ('PRO', 'Production'), > ('MKG', 'Marketing'), > ('EXP', 'Export'), > ('ITD', 'IT'), > ) > > LEVELS = ( > ('SM', 'Senior Manager'), > ('MR', 'Manager'), > ('SP', 'Supervisor'), > ('ST', 'Staff'), > ) > > class User(models.Model): > """KSK Employee accounts to use this application""" > > user = models.ForeignKey(AdminUser) > department = models.CharField(maxlength=3, choices=DEPARTMENTS) > level = models.CharField(maxlength=3, choices=LEVELS) > > Thanks > james > > On Jul 19, 2:56 pm, Nathan Ostgard <[EMAIL PROTECTED]> wrote: > > > manage.py syncdb won't add new fields to the database if the table > > already exists. You'll have to do this yourself. See manage.py sqlall > > for some help. > > > Otherwise, if you have: user = models.ForeignKey(User), then look for > > a field named user_id in your table. > > > -------- > > Nathan Ostgard > > > On Jul 18, 9:57 pm, james_027 <[EMAIL PROTECTED]> wrote: > > > > hi, > > > > I have a model with a field models.ForeignKey(), with manage.py > > > validate I check if my code are right, then run manage.py syncdb. When > > > I was checking the tables generated I don't see any foreign key > > > created? Is there something wrong? where should I check? > > > > I am using django 0.96, mysql 5 on winxp > > > > Thanks > > > james --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---