Hi all,
I'm using django for a couple of years, and I've a question about relations in the ORM and templates. I massively use class-based generic views.
I' currently working with a model which have many other models FKing to it :
class People(models.Model):
last_name = models.CharField(max_length=255)
... other fields ...
class PhoneNumber(models.Model):
people = models.ForeignKey("my_app.People")
number = models.CharField(max_length=255)
... other fields ...
According to documentation, it is possible to use a `People.phonenumber_set` attribute from a people instance, queryset'ing related phone numbers from people.
in may template "myapp/people_detail.html", when I query this attribute from my template, by using {% for phonenumber in object.phonenumber_set.all %}[% endfor %}, I do not any phone number...
When I step -to-step debug the application, I can see a "myapp_phonenumber_related" related manager, but no phonenumber_set.
Do I miss something ?
Thanks for your great job...
-- I'm using django for a couple of years, and I've a question about relations in the ORM and templates. I massively use class-based generic views.
I' currently working with a model which have many other models FKing to it :
class People(models.Model):
last_name = models.CharField(max_length=255)
... other fields ...
class PhoneNumber(models.Model):
people = models.ForeignKey("my_app.People")
number = models.CharField(max_length=255)
... other fields ...
According to documentation, it is possible to use a `People.phonenumber_set` attribute from a people instance, queryset'ing related phone numbers from people.
in may template "myapp/people_detail.html", when I query this attribute from my template, by using {% for phonenumber in object.phonenumber_set.all %}[% endfor %}, I do not any phone number...
When I step -to-step debug the application, I can see a "myapp_phonenumber_related" related manager, but no phonenumber_set.
Do I miss something ?
Thanks for your great job...
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5b2a2a5-1385-48bb-a738-6e65b3a9106c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment