If this is the wrong list to post a newbie question please let me
know. I'm getting an error message while trying to populate the tables
created by the models and not sure why. Here are the models

from django.db import models

class County(models.Model):
    name = models.CharField(max_length=80)
    slug = models.CharField(max_length=80)

    def __unicode__(self):
        return self.name

    def get_absolute_url(self):
        return "/countries/%s/" % self.slug

class Company(models.Model):
    name = models.CharField(max_length=50)
    address = models.CharField(max_length=80)
    client = models.CharField(max_length=50)
    city = models.CharField(max_length=50)
    county = models.ForeignKey(Country)
    dollar_amount = models.DecimalField('Cost (in dollars)',
max_digits=10, decimal_places=2)


    def __unicode__(self):
        return self.name


So I go into the shell and type this:

>>c=County(name='blah blah, slug="blah-blah")

then
>> l = Company(name='xyz corp', address='56 b. street', client='G corp', city = 
>> 'Walla Walla', county='blah blah', dollar_amount =54000)

The error message I get is Valueerror: Cannot assign "blah blah" :
"Company.county" must be a "County" instance.

doesn't this create the instance?
 >> c=County('blah blah', slug='blah-blah')


Any suggestion or point out my error would be appreciated.




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to