Created
December 11, 2012 18:57
-
-
Save groovecoder/4261039 to your computer and use it in GitHub Desktop.
document children wtf?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Pdb) p Document.objects.get(slug='parent') | |
<Document: [en-US] parent> | |
(Pdb) p Document.objects.get(slug='child') | |
<Document: [en-US] child> | |
(Pdb) p Document.objects.get(slug='child').parent | |
<Document: [en-US] parent> | |
(Pdb) p (Document.objects.get(slug='parent') == Document.objects.get(slug='child').parent) | |
True | |
(Pdb) p Document.objects.get(slug='parent').children | |
<django.db.models.fields.related.RelatedManager object at 0xa4d4eac> | |
(Pdb) p Document.objects.get(slug='parent').children.count() | |
0 | |
(Pdb) p Document.objects.get(slug='parent').id | |
1L | |
(Pdb) p Document.objects.get(slug='child').id | |
2L |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
children is this: https://github.com/mozilla/kuma/blob/master/apps/wiki/models.py#L564