Hi, I've got the two models Country and Restaurant shown below. Is there a way to directly set a country by instanciating a restaurant with a Country instance? Something like:
r=Restaurant(name='whatever', country=Country(name='newcountry')) r.save() which returns "Column 'country_id' cannot be null" Or do I have to previously check if the country exists, and creating it if it doesn't? Thanks jul class Country(models.Model): name = models.CharField(max_length=100, unique=True) class Restaurant(models.Model): name = models.CharField(max_length=100) country=models.ForeignKey(Country) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---