Hi guys. This model error is driving me up the wall. All of my debug
attempts thus far have been fruitless.
I've got a model error that appears whenever I use `manage.py shell`,
but not when my code is running in production-- which is making
debugging very difficult. Here is the traceback and model class
definition:
"""
" " Context and Traceback
" " from internactive `manage.py shell` console
"""
Python 2.7.1 (r271:86832, Sep 13 2011, 19:13:17)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from product.models import Product
>>> from main.models import Offer
>>> p = Product.objects.get(id=307)
>>> p
<Product: Pencil>
>>> p.offer_sender_set.all()
[<Offer: iuwolf to VoluntaryTrader - 2012-05-31 21:24:22.618775>]
>>> o = p.offer_sender_set.all()[0]
>>> o
<Offer: iuwolf to VoluntaryTrader - 2012-05-31 21:24:22.618775>
>>> o.sender_items
<django.db.models.fields.related.ManyRelatedManager object at
0x2261a50>
>>> o.sender_items.all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
manager.py", line 117, in all
return self.get_query_set()
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
fields/related.py", line 497, in get_query_set
return
superclass.get_query_set(self).using(db)._next_is_sticky().filter(**(self.core_filters))
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
query.py", line 550, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
query.py", line 568, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
sql/query.py", line 1194, in add_q
can_reuse=used_aliases, force_having=force_having)
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
sql/query.py", line 1069, in add_filter
negate=negate, process_extras=process_extras)
File "/home/<omitted>/webapps/django/lib/python2.7/django/db/models/
sql/query.py", line 1260, in setup_joins
"Choices are: %s" % (name, ", ".join(names)))
FieldError: Cannot resolve keyword 'offer_sender_set' into field.
Choices are: active, also_purchased, cartitem, category,
configurableproduct, customproduct, date_added, description, discount,
featured, height, height_units, id, items_in_stock, length,
length_units, meta, myproduct, name, ordering, orderitem, price,
productattribute, productimage, productvariation, related_items,
shipclass, short_description, site, sku, slug, taxClass, taxable,
total_sold, translations, watched_by, weight, weight_units, width,
width_units
"""
" " Definition of `Offer` model class.
" " The `Product` model class is from the Satchmo `product` app.
"""
class Offer(models.Model):
created_at = models.DateTimeField( auto_now_add=True )
last_modified = models.DateTimeField( auto_now=True )
code = models.CharField( max_length=16, editable=False,
db_index=True, unique=True )
active = models.BooleanField( default=True )
accepted = models.BooleanField( default=False )
accepted_at = models.DateTimeField( blank=True, null=True )
collapsed = models.BooleanField( default=False )
collapsed_at = models.DateTimeField( blank=True, null=True )
sender = models.ForeignKey( User,
related_name='offer_sender_set' )
sender_items = models.ManyToManyField( Product,
related_name='offer_sender_set' )
recipient = models.ForeignKey( User,
related_name='offer_recipient_set' )
recipient_items = models.ManyToManyField( Product,
related_name='offer_recipient_set' )
""" methods ommitted for brevity """
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment