Giter Club home page Giter Club logo

Comments (7)

davedash avatar davedash commented on June 17, 2024 1

I think this is how fixed.

from django-fixture-magic.

cb109 avatar cb109 commented on June 17, 2024

The root of this issue lies in some backwards compatibility code in Django versions older than 1.10. They try to mimic some optparse behaviour (which seemingly was the old argument parser) in regards to accepting positional arguments. This line is the culprit: https://github.com/django/django/blob/stable/1.9.x/django/core/management/base.py#L309

The issue is gone with Django 1.10+, compare this: https://github.com/django/django/blob/stable/1.10.x/django/core/management/base.py#L260

This behaviour conflicts with your id argument because both use nargs='*'. Only happens because your command overwrites the args class attribute (I guess you did this to provide more helpful commandline descriptions?).

Two fixes come to mind:

  • Do not overwrite the args attribute in the Command class.
  • Handle parser creation based on Django version and workaround the conflicting behaviour.

I will send you a pull request for the latter.

from django-fixture-magic.

jason-utilityapi avatar jason-utilityapi commented on June 17, 2024

@cb109 @davedash As far as I can tell, there isn't any reason to overwrite the args attribute in the Command class anymore. This is a relic of the 1.7 and earlier versions of Django. It's been completely removed from the docs for versions 1.8 and greater. Removing this line fixes this issue for Django 1.8 and 1.9:

https://github.com/davedash/django-fixture-magic/blob/master/fixture_magic/management/commands/dump_object.py#L22

from django-fixture-magic.

cb109 avatar cb109 commented on June 17, 2024

Sounds like the best solution to me if backwards compatibility is not of concern 👍

from django-fixture-magic.

jason-utilityapi avatar jason-utilityapi commented on June 17, 2024

Not really much of an issue. Anything earlier than Django 1.8 is no longer a supported version of Django anyway.

Django 1.7 has been unsupported since December of 2015.
https://www.djangoproject.com/download/

Since 1.8 is the active LTS release of Django, it makes sense for django-fixture-magic to support it.

from django-fixture-magic.

davedash avatar davedash commented on June 17, 2024

If someone can resolve the conflicts in #48 then I can merge this in and this might be closable.

from django-fixture-magic.

jason-utilityapi avatar jason-utilityapi commented on June 17, 2024

@davedash I have created a pull request that should resolve this. It's removing the args line since it's not needed and just creating issues in Django 1.8 and Django 1.9.

from django-fixture-magic.

Related Issues (20)

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.