#34312: startapp/startproject template should support file renames with the full
context
-------------------------------------+-------------------------------------
               Reporter:  Will       |          Owner:  nobody
  Gordon                             |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Core       |        Version:  dev
  (Management commands)              |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Currently, startapp/startproject will ''only'' perform a file rename with
 "app_name"/"project_name",
 
https://github.com/django/django/blob/main/django/core/management/templates.py#L180.

 I am requesting that it would be possible to use the entirety of values
 within the `context`. E.g.


 {{{
   new_path = os.path.join(top_dir, relative_dir, filename)
   # Sort context by length of the key, so that longer keys are tested
 first
   for key, value in sorted(context.dicts[-1].items(), key=lambda kv:
 len(kv[0]), reverse=True):
       if key in new_path:
           new_path = new_path.replace(key, value)
           break
 }}}

 This would allow the usage of filenames like `camel_case_nameFilename.py-
 tpl` to be replaced with `AppNameFilename.py`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34312>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018624997b65-41f25f54-14fa-4702-a6aa-2fcbf760e2bd-000000%40eu-central-1.amazonses.com.

Reply via email to