Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_tenants fails when tenant and domain have fields with same name #167

Closed
nschlemm opened this issue May 20, 2018 · 0 comments · Fixed by #168
Closed

create_tenants fails when tenant and domain have fields with same name #167

nschlemm opened this issue May 20, 2018 · 0 comments · Fixed by #168

Comments

@nschlemm
Copy link
Contributor

e.g. when both tenant and domain model have a "status" field, this will throw:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.p
y", line 371, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.p
y", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py",
line 280, in run_from_argv
    parser = self.create_parser(argv[0], argv[1])
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py",
line 254, in create_parser
    self.add_arguments(parser)
  File "/usr/local/lib/python3.6/site-packages/django_tenants/management/command
s/create_tenant.py", line 31, in add_arguments
    parser.add_argument('--%s' % field.name, help="Specifies the %s for the tena
nt's domain." % field.name)
  File "/usr/local/lib/python3.6/argparse.py", line 1348, in add_argument
    return self._add_action(action)
  File "/usr/local/lib/python3.6/argparse.py", line 1711, in _add_action
    self._optionals._add_action(action)
  File "/usr/local/lib/python3.6/argparse.py", line 1552, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/local/lib/python3.6/argparse.py", line 1362, in _add_action
    self._check_conflict(action)
  File "/usr/local/lib/python3.6/argparse.py", line 1501, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/local/lib/python3.6/argparse.py", line 1510, in _handle_conflict_er
ror
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --status: conflicting option string: --status

I'll propose a simple "--domain-" prefix for those automatically added fields

nschlemm added a commit to nschlemm/django-tenants that referenced this issue May 20, 2018
fix django-tenants#167 by avoiding argument conflicts for those automatically added parameters from tenant and domain fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant