I need to return a queryset, to be serialized for ajax. I have a Store
object, which references a State object.
State.objects.all() currently returns the state value as the ID field
for the State object. But I need it to instead return the l_state
Any insight?
Thanks
Mike
See below:
=========
class Store(models.Model):
name = models.CharField(maxlength=100)
url = models.URLField(null=True,blank=True)
addr1 = models.CharField(maxlength=100,null=True,blank=True)
addr2 = models.CharField(maxlength=100,null=True,blank=True)
state = models.ForeignKey(State)
zip_code = models.CharField(maxlength=10,null=True,blank=True)
city = models.CharField(maxlength=100,null=True,blank=True)
phone = models.PhoneNumberField(null=True,blank=True)
def __str__(self):
return "%s" % (self.name)
class State(models.Model):
country = models.ForeignKey(Country)
l_state = models.TextField()
s_state = models.TextField()
def __str__(self):
return "%s" % (self.l_state)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---