Django ForeignKey created empty?
Posted
by Scott Willman
on Stack Overflow
See other posts from Stack Overflow
or by Scott Willman
Published on 2010-04-16T03:22:58Z
Indexed on
2010/04/16
3:33 UTC
Read the original article
Hit count: 327
django
|foreignkey
This seems very basic and I must be missing something, but here goes anyways...
With two models like so:
class School(models.Model):
name = models.CharField("Official School Name", max_length=128)
address = models.TextField("Address of the School", max_length=256)
mascot = models.CharField("Name of the School Mascot", max_length=128)
class StudentProfile(models.Model):
name = models.CharField(max_length=128)
school = models.ForeignKey(School)
If the student gets created before the school, how do I give 'school' a default empty value? Is it blank or null or what?
Thanks!
© Stack Overflow or respective owner