Re: Optional URL parameters in django.urls.path

2022-10-02 Thread Carlton Gibson
Hi. Re-reading again, I'm still not sure (personally) of the need/motivation given either of the "use two entries" or "use re_path()" options. Maybe it would be a nice-to-have but I'm not seeing the benefit as outweighing the complexity (remembering docs, and tests, and related functionality such

`call_command` raises ValueError during testing

2022-10-02 Thread Ferran Jovell
Hello everyone, I was working on a admin command today, and when setting up tests and fixtures for running the command during testing I found this error: Traceback (most recent call last): File "/home/fjm/code/django-stuff/tutorial/polls/tests.py", line 10, in test_command_output call_comma

Re: `call_command` raises ValueError during testing

2022-10-02 Thread Tim Graham
Hi Ferran, It looks like opt.option_strings is empty because "poll_ids" (in parser.add_argument()) isn't prefixed with a dash or double dash. You could instead use call_command() like this: call_command("closepoll", 1) But I think your invocation could be fixed (or at least not fail so obscur