Giter VIP home page Giter VIP logo

Comments (7)

coleifer avatar coleifer commented on August 22, 2024

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.

jpic avatar jpic commented on August 22, 2024

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.

coleifer avatar coleifer commented on August 22, 2024

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.

jpic avatar jpic commented on August 22, 2024

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.

coleifer avatar coleifer commented on August 22, 2024

Yeah, the simple test runner is deprecated, will look into fixing that soon. Thanks will comment on your pull request.

from django-generic-m2m.

jpic avatar jpic commented on August 22, 2024

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.

coleifer avatar coleifer commented on August 22, 2024

See pull request #9 for continued discussion.

from django-generic-m2m.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.