Re: Name clashes on custom commands

2020-04-10 Thread Tim Johnson

Ah. I see the logic of it. Similar to elisp, but different also.

Thank you

On 4/10/20 12:44 AM, Andréas Kühne wrote:

Hi Tim,

You need to make sure that your commands are unique in your project. 
Otherwise like you have discovered one overwrites the other. This is 
actually a good thing though - we use it in one of our projects to 
override the "runserver" command. The order of the applications in 
your project dictates which command is run.


Regards,

Andréas


Den fre 10 apr. 2020 kl 00:18 skrev Tim Johnson >:


I have more of an observation than a question and it is likely
that any
responses may serendipitously enlighten me.

 From the contributions of good djangoists to an earlier query on my
part (subject ORM from the command line) I have been enlightened
about
custom commands and django-extensions and I couldn't be happier about
having more tools in my kit.

I used the create_command subcommand to create a custom subcommand
under
one app, called articles. It defaults as sample so I left it as such.
Tweaked it a bit to make it runnable and examined the output of
'python
manage.py help'. I could see there that 'sample' shows under the
[articles] header.

So, I repeated the create_command process to create a command under a
different app called pages. Again, the command is named
'sample.py' in
keeping with the default action.

I could then see 'sample' listed out under the [pages] heading and
indeed, that is the one and only command that is run.

My comment/question is : is there a way to resolve such command name
clashes? I saw no sign of an option that would allow associating like
names with different apps.

It is easy to resolve, of course: trivial example being
articles_sample.py and pages_sample.py

-- 
Tim

tj49.com 

-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscr...@googlegroups.com
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/3c9455ae-ba2b-a3dd-a2b2-4306f1826160%40akwebsoft.com.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCeEexFZC_gEGX%3D%3DoQnNP0CJqQGQv%3DLOmdovYw6K-c_NnA%40mail.gmail.com 
.


--
Tim
tj49.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1383d7fe-094e-3869-956d-5ad80b5cc91d%40akwebsoft.com.


Re: Name clashes on custom commands

2020-04-10 Thread Andréas Kühne
Hi Tim,

You need to make sure that your commands are unique in your project.
Otherwise like you have discovered one overwrites the other. This is
actually a good thing though - we use it in one of our projects to override
the "runserver" command. The order of the applications in your project
dictates which command is run.

Regards,

Andréas


Den fre 10 apr. 2020 kl 00:18 skrev Tim Johnson :

> I have more of an observation than a question and it is likely that any
> responses may serendipitously enlighten me.
>
>  From the contributions of good djangoists to an earlier query on my
> part (subject ORM from the command line) I have been enlightened about
> custom commands and django-extensions and I couldn't be happier about
> having more tools in my kit.
>
> I used the create_command subcommand to create a custom subcommand under
> one app, called articles. It defaults as sample so I left it as such.
> Tweaked it a bit to make it runnable and examined the output of 'python
> manage.py help'. I could see there that 'sample' shows under the
> [articles] header.
>
> So, I repeated the create_command process to create a command under a
> different app called pages. Again, the command is named 'sample.py' in
> keeping with the default action.
>
> I could then see 'sample' listed out under the [pages] heading and
> indeed, that is the one and only command that is run.
>
> My comment/question is : is there a way to resolve such command name
> clashes? I saw no sign of an option that would allow associating like
> names with different apps.
>
> It is easy to resolve, of course: trivial example being
> articles_sample.py and pages_sample.py
>
> --
> Tim
> tj49.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3c9455ae-ba2b-a3dd-a2b2-4306f1826160%40akwebsoft.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCeEexFZC_gEGX%3D%3DoQnNP0CJqQGQv%3DLOmdovYw6K-c_NnA%40mail.gmail.com.


Name clashes on custom commands

2020-04-09 Thread Tim Johnson
I have more of an observation than a question and it is likely that any 
responses may serendipitously enlighten me.


From the contributions of good djangoists to an earlier query on my 
part (subject ORM from the command line) I have been enlightened about 
custom commands and django-extensions and I couldn't be happier about 
having more tools in my kit.


I used the create_command subcommand to create a custom subcommand under 
one app, called articles. It defaults as sample so I left it as such. 
Tweaked it a bit to make it runnable and examined the output of 'python 
manage.py help'. I could see there that 'sample' shows under the 
[articles] header.


So, I repeated the create_command process to create a command under a 
different app called pages. Again, the command is named 'sample.py' in 
keeping with the default action.


I could then see 'sample' listed out under the [pages] heading and 
indeed, that is the one and only command that is run.


My comment/question is : is there a way to resolve such command name 
clashes? I saw no sign of an option that would allow associating like 
names with different apps.


It is easy to resolve, of course: trivial example being 
articles_sample.py and pages_sample.py


--
Tim
tj49.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3c9455ae-ba2b-a3dd-a2b2-4306f1826160%40akwebsoft.com.