Monday, July 2, 2012

Foreign Key needs quotes?

Hi Djangoers,

I am following the tutorial and found something I am not sure if is right or wrong? So here is my question,

In the tutorial 01 where we need to create two models in models.py, we are providing the ForeignKey to the 'Choice' model for 'Poll' model without quotes,

    class Choice(models.Model):      poll = models.ForeignKey(Poll)

But when I went to read about Foreign key a bit more in detail, I found that the model 'Car' is being given the 'Manufacture' ForeignKey in quotes,

    class Car(models.Model):  
        manufacturer = models.ForeignKey('Manufacturer') 

So I wanted to know, which is the right way to go or it does not matter?
--
Thanks & Regards
Smaran Harihar

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment