| 1 | In [1]: from afns.apps.genericunique.models import Pony,Person
|
|---|
| 2 |
|
|---|
| 3 | In [2]: from django.contrib.auth.models import User
|
|---|
| 4 |
|
|---|
| 5 | In [3]: u1 = User.objects.all()[0]
|
|---|
| 6 |
|
|---|
| 7 | In [4]: u2 = User.objects.all()[1]
|
|---|
| 8 |
|
|---|
| 9 | In [5]: person1 = Person(user=u1)
|
|---|
| 10 |
|
|---|
| 11 | In [6]: person1.save()
|
|---|
| 12 |
|
|---|
| 13 | In [7]: person2 = Person(user=u2)
|
|---|
| 14 |
|
|---|
| 15 | In [8]: person2.save()
|
|---|
| 16 |
|
|---|
| 17 | In [9]: pony1 = Pony(purpleness=0,content_object=person1)
|
|---|
| 18 |
|
|---|
| 19 | In [10]: pony1.save()
|
|---|
| 20 |
|
|---|
| 21 | In [11]: pony2 = Pony(purpleness=-1,content_object=person2)
|
|---|
| 22 |
|
|---|
| 23 | In [12]: pony2.save()
|
|---|
| 24 |
|
|---|
| 25 | In [13]: Person.objects.all().order_by("pony__purpleness")
|
|---|
| 26 | Out[13]: ---------------------------------------------------------------------------
|
|---|
| 27 | <class 'django.core.exceptions.FieldError'>Traceback (most recent call last)
|
|---|
| 28 |
|
|---|
| 29 | /home/svn/django/afns/<ipython console> in <module>()
|
|---|
| 30 |
|
|---|
| 31 | /usr/local/python25/lib/python2.5/site-packages/IPython/Prompts.py in __call__(self, arg)
|
|---|
| 32 | 521
|
|---|
| 33 | 522 # and now call a possibly user-defined print mechanism
|
|---|
| 34 | --> 523 manipulated_val = self.display(arg)
|
|---|
| 35 | 524
|
|---|
| 36 | 525 # user display hooks can change the variable to be stored in
|
|---|
| 37 |
|
|---|
| 38 | /usr/local/python25/lib/python2.5/site-packages/IPython/Prompts.py in _display(self, arg)
|
|---|
| 39 | 545 """
|
|---|
| 40 | 546
|
|---|
| 41 | --> 547 return self.shell.hooks.result_display(arg)
|
|---|
| 42 | 548
|
|---|
| 43 | 549 # Assign the default display method:
|
|---|
| 44 |
|
|---|
| 45 | /usr/local/python25/lib/python2.5/site-packages/IPython/hooks.py in __call__(self, *args, **kw)
|
|---|
| 46 | 132 #print "prio",prio,"cmd",cmd #dbg
|
|---|
| 47 | 133 try:
|
|---|
| 48 | --> 134 ret = cmd(*args, **kw)
|
|---|
| 49 | 135 return ret
|
|---|
| 50 | 136 except ipapi.TryNext, exc:
|
|---|
| 51 |
|
|---|
| 52 | /usr/local/python25/lib/python2.5/site-packages/IPython/hooks.py in result_display(self, arg)
|
|---|
| 53 | 160
|
|---|
| 54 | 161 if self.rc.pprint:
|
|---|
| 55 | --> 162 out = pformat(arg)
|
|---|
| 56 | 163 if '\n' in out:
|
|---|
| 57 | 164 # So that multi-line strings line up with the left column of
|
|---|
| 58 |
|
|---|
| 59 | /usr/local/python25/lib/python2.5/pprint.py in pformat(self, object)
|
|---|
| 60 | 109 def pformat(self, object):
|
|---|
| 61 | 110 sio = _StringIO()
|
|---|
| 62 | --> 111 self._format(object, sio, 0, 0, {}, 0)
|
|---|
| 63 | 112 return sio.getvalue()
|
|---|
| 64 | 113
|
|---|
| 65 |
|
|---|
| 66 | /usr/local/python25/lib/python2.5/pprint.py in _format(self, object, stream, indent, allowance, context, level)
|
|---|
| 67 | 127 self._readable = False
|
|---|
| 68 | 128 return
|
|---|
| 69 | --> 129 rep = self._repr(object, context, level - 1)
|
|---|
| 70 | 130 typ = _type(object)
|
|---|
| 71 | 131 sepLines = _len(rep) > (self._width - 1 - indent - allowance)
|
|---|
| 72 |
|
|---|
| 73 | /usr/local/python25/lib/python2.5/pprint.py in _repr(self, object, context, level)
|
|---|
| 74 | 193 def _repr(self, object, context, level):
|
|---|
| 75 | 194 repr, readable, recursive = self.format(object, context.copy(),
|
|---|
| 76 | --> 195 self._depth, level)
|
|---|
| 77 | 196 if not readable:
|
|---|
| 78 | 197 self._readable = False
|
|---|
| 79 |
|
|---|
| 80 | /usr/local/python25/lib/python2.5/pprint.py in format(self, object, context, maxlevels, level)
|
|---|
| 81 | 205 and whether the object represents a recursive construct.
|
|---|
| 82 | 206 """
|
|---|
| 83 | --> 207 return _safe_repr(object, context, maxlevels, level)
|
|---|
| 84 | 208
|
|---|
| 85 | 209
|
|---|
| 86 |
|
|---|
| 87 | /usr/local/python25/lib/python2.5/pprint.py in _safe_repr(object, context, maxlevels, level)
|
|---|
| 88 | 290 return format % _commajoin(components), readable, recursive
|
|---|
| 89 | 291
|
|---|
| 90 | --> 292 rep = repr(object)
|
|---|
| 91 | 293 return rep, (rep and not rep.startswith('<')), False
|
|---|
| 92 | 294
|
|---|
| 93 |
|
|---|
| 94 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py in __repr__(self)
|
|---|
| 95 |
|
|---|
| 96 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py in __len__(self)
|
|---|
| 97 |
|
|---|
| 98 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py in iterator(self)
|
|---|
| 99 |
|
|---|
| 100 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py in results_iter(self)
|
|---|
| 101 |
|
|---|
| 102 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py in execute_sql(self, result_type)
|
|---|
| 103 |
|
|---|
| 104 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py in as_sql(self, with_limits)
|
|---|
| 105 |
|
|---|
| 106 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py in get_ordering(self)
|
|---|
| 107 |
|
|---|
| 108 | /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py in find_ordering_name(self, name, opts, alias, default_order, already_seen)
|
|---|
| 109 |
|
|---|
| 110 | <class 'django.core.exceptions.FieldError'>: Cannot order by many-valued field: 'pony__purpleness'
|
|---|