Querysets should only allow the correct model types to be filtered against
Here's a simple example of what is allowed at the moment. It seems that this should throw an exception for the last line:
In [1]: from django.contrib.auth.models import *
In [3]: u = User.objects.all()[0]
In [5]: m = Message.objects.create(user=u, message='test')
In [6]: m.pk, u.pk
Out[6]: (1, 1)
In [10]: User.objects.filter(message=m)
Out[10]: [<User: chris_b>]
In [11]: User.objects.filter(message=u)
Out[11]: [<User: chris_b>]
Change History
(12)
milestone: |
→ 1.3
|
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to anonymous
|
Status: |
new → assigned
|
Owner: |
changed from anonymous to Aviral Dasgupta
|
Status: |
assigned → new
|
Owner: |
Aviral Dasgupta removed
|
Severity: |
→ Normal
|
Type: |
→ Bug
|
Resolution: |
→ duplicate
|
Status: |
new → closed
|
It seems last line wil not throw an exception but returns empty list
<Message: test>
<User: admin>
[<User: admin>]
[]