TemplateCommand

59 views
Skip to first unread message

Christian González

unread,
Jun 28, 2021, 3:32:22 AM6/28/21
to django-developers
Hi all,

I recently made a plugin framework for django (GDAPS), and needed to do
some templating. I had seen that there is an undocumented
TemplaceCommand in Django which does, well, what it does.

It is a little opinionated and not very flexible, so I couldn't inherit
from it for my project, but had to reimplement it, more generic.

Now what I thought, wouldn't it be good to have that command available
as base class for other projects as well?

Please have a quick look at this class:

https://gitlab.com/nerdocs/gdaps/-/blob/7a363167ca8e20cdca952187314306874bd93a05/gdaps/management/templates/__init__.py

I used it for generating a new plugin - but due to not needing this any
more in the project's tree (plugins now can be developed outside and
separatedly) I change my templating system to cookiecutter.

But - if you are interested to use that class, replace Django's
TemplateCommand with it and inherit from it, I could bring it into shape.

Please drop me a line.

Best regards, Christian

--
Dr. Christian González
https://nerdocs.at


Adam Johnson

unread,
Jun 28, 2021, 4:45:08 AM6/28/21
to django-d...@googlegroups.com
Django has the TemplateCommand class to support its startproject and startapp. These two are fairly similar so the class exists to share code between them.

As I understand, your GDAPS project aims to provide similar functionality, but with differences. In this case I can see that you'd have overlap with what startproject/startapp already do, but I don't see that as a reason for Django to document or change its TemplateCommand class. If we documented the class, it would become a public API and contribute more to Django's maintenance burden. That doesn't sound worth it for this niche use case. Plus, it's not *that* much code to "take inspiration from" in your own project, test, and change as you see fit.

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a6efb88d-963d-fdda-f499-18616e315609%40nerdocs.at.

Christian González

unread,
Jun 29, 2021, 10:01:58 AM6/29/21
to 'Adam Johnson' via Django developers (Contributions to Django itself)

Am 28.06.21 um 10:44 schrieb 'Adam Johnson' via Django developers
(Contributions to Django itself):
> Plus, it's not *that* much code to "take inspiration from" in your own
> project, test, and change as you see fit.

That's true...

;-)
Reply all
Reply to author
Forward
0 new messages