Comments (7)
The idea of adding the reverse has certainly occurred to me, but I'm not sure how best to go about accomplishing it. Since you can use the RelatedObjectsDescriptor
to add a relationship to any other model, that would necessitate adding a RelatedObjectsDescriptor to all the models (or at least all the ones you've connected to).
from django-generic-m2m.
That makes sense, it should be the responsability of the developper to monkey patch other models. However, one could have expected other results than those:
In [4]: monkey_patch(TestModel)
Out[4]: True
In [5]: TestModel.objects.get(name='test').related.all()
Out[5]: []
In [6]: Document.objects.get(pk=1).related.all()
Out[6]: [<RelatedObject: avatar_big.png related to test ("")>]
What do you think ? Should Out[5] be the same than Out[6] ?
Thanks a lot for your feedback.
from django-generic-m2m.
Can you write a testcase? I'm not sure i'm seeing the issue given that you're using models specific to your app.
from django-generic-m2m.
Sure, do you know a way to run the tests with Django 1.4 or is a downgrade to Django 1.3 necessary ?
<<< 18:56.53 Thu Jul 12 2012!~/env/src/genericm2m
<<< jpic@germaine!10090 E:1 G:master env
>>> python setup.py test
running test
running egg_info
writing django_generic_m2m.egg-info/PKG-INFO
writing top-level names to django_generic_m2m.egg-info/top_level.txt
writing dependency_links to django_generic_m2m.egg-info/dependency_links.txt
reading manifest file 'django_generic_m2m.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'LICENSE.txt'
writing manifest file 'django_generic_m2m.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 32, in <module>
test_suite='runtests.runtests',
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/jpic/env/local/lib/python2.7/site-packages/setuptools/command/test.py", line 137, in run
self.with_project_on_sys_path(self.run_tests)
File "/home/jpic/env/local/lib/python2.7/site-packages/setuptools/command/test.py", line 117, in with_project_on_sys_path
func()
File "/home/jpic/env/local/lib/python2.7/site-packages/setuptools/command/test.py", line 146, in run_tests
testLoader = loader_class()
File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/usr/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/home/jpic/env/src/genericm2m/runtests.py", line 27, in <module>
from django.test.simple import run_tests
ImportError: cannot import name run_tests
from django-generic-m2m.
Yeah, the simple test runner is deprecated, will look into fixing that soon. Thanks will comment on your pull request.
from django-generic-m2m.
Sorry for that first pull request, my text editor removes spaces on empty lines by default ... The new pull request is clean thought.
from django-generic-m2m.
See pull request #9 for continued discussion.
from django-generic-m2m.
Related Issues (18)
- doctest in tests HOT 1
- help_text and verbose_name keyword arguments HOT 1
- Get all by type HOT 1
- ValidationError raised in admin interface when used with django-autocomplete-light HOT 2
- Release on Pypi HOT 1
- Handle non-existent relation "genericm2m_relatedobject" HOT 4
- Admin Interface HOT 4
- Deprecation warnings.
- KeyError exception when calling generic_objects
- Unable to install package with pip: python setup.py egg_info failed HOT 1
- Older versions of Django HOT 1
- Initial migration fails HOT 1
- Q: are multiple related fields permissible on one model?
- add translations
- Is the project still maintained?
- Example App admin needs basic.inlines installed
- Duplicate connections HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-generic-m2m.