Opened 11 years ago
Last modified 11 years ago
#22877 closed Uncategorized
Segfault when converting objects.prefetch_related into boolean condition. — at Initial Version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.6 |
Severity: | Normal | Keywords: | Segmentation Fault, |
Cc: | Shai Berger | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
Lets take the following models:
#models.py
class Item()
class UserProfile()
class Appreciation(models.Model):
item = models.ForeignKey(Item,
verbose_name=_('item_appreciations'),
related_name='item_appreciation')
user_profile = models.ForeignKey(
UserProfile, verbose_name=_('user profile'), related_name='user_profile_appreciation'
)
####
With a populated database, the following line trigger a Segmentation fault:
#Main.py
if Item.objects.prefetch_related('item_appreciation'):
print 'lol'