django-seed icon indicating copy to clipboard operation
django-seed copied to clipboard

error: unrecognized arguments: --seeder

Open timomeara opened this issue 2 years ago • 4 comments

"--seeder" arg not working in management command

this command: ./manage.py seed location --number=10 --seeder "Address.hours" "None"

gives me: manage.py seed: error: unrecognized arguments: --seeder Address.hours {}

Django==3.2.4 Python 3.8.10

timomeara avatar Jul 30 '21 20:07 timomeara

I have the same issue

Daveson217 avatar Aug 23 '21 13:08 Daveson217

Having this issue as well.

elebumm avatar Sep 28 '21 19:09 elebumm

I am only able to reproduce this error if I pass unknown arguments to the seed management command. It looks like the --seeder flag was added in version 0.3.0 here. I suspect that you are using an older version of the library than this. For example, if I pass the flag --does-not-exist, I get the same kind of message:

$ python manage.py seed seed_test --number=1 --does-not-exist "ToBeSeeded.foo" "None"
manage.py seed: error: unrecognized arguments: --does-not-exist ToBeSeeded.foo None

To kind of prove this to myself, I did a checkout of the previous version, 0.2.2, and was able to reproduce the error exactly:

$ git checkout 0.2.2
$ python manage.py seed seed_test --number=1 --seeder "ToBeSeeded.foo" "None"
manage.py seed: error: unrecognized arguments: --seeder ToBeSeeded.foo None

Note, however, that if I am using version 0.3.0, it works just fine:

$ git checkout 0.3.0
$ python manage.py seed seed_test --number=1 --seeder "ToBeSeeded.foo" "None"
Model ToBeSeeded generated record with primary key 58

Lastly, it looks like the latest version on pypi is 0.2.2, so it seems like we need the maintainer to upload the more recent version to address this issue before resolving.

havocbane avatar Oct 02 '21 23:10 havocbane

I'm having an issue where it just ignores my given fields. If I do

python manage.py seed users --number=1 --seeder "User.type" "client"

my db is populated with the default type argument, and not client.

However, if I run in the shell

In [1]: seeder.add_entity(User, 1, {'type': 'client'})
In [2]: seeder.execute()

It populates correctly. I think there's some error in the cli command.

I'm using 0.3.1

j-krl avatar Jan 11 '22 22:01 j-krl