Commit e6dd7f99 authored by Mounir Messelmeni's avatar Mounir Messelmeni Committed by Tim Graham
Browse files

Fixed #24971 -- Made startapp generate an apps.py

parent c5eca746
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
default_app_config = '{{ app_name }}.apps.{{ camel_case_app_name }}Config'
+5 −0
Original line number Diff line number Diff line
from django.apps import AppConfig


class {{ camel_case_app_name }}Config(AppConfig):
    name = '{{ app_name }}'
+3 −0
Original line number Diff line number Diff line
@@ -98,10 +98,13 @@ class TemplateCommand(BaseCommand):
        base_name = '%s_name' % app_or_project
        base_subdir = '%s_template' % app_or_project
        base_directory = '%s_directory' % app_or_project
        camel_case_name = 'camel_case_%s_name' % app_or_project
        camel_case_value = ''.join(x for x in name.title() if x != '_')

        context = Context(dict(options, **{
            base_name: name,
            base_directory: top_dir,
            camel_case_name: camel_case_value,
            'docs_version': get_docs_version(),
            'django_version': django.__version__,
            'unicode_literals': '' if six.PY3 else 'from __future__ import unicode_literals\n\n',
+5 −0
Original line number Diff line number Diff line
@@ -1094,8 +1094,13 @@ with the ``--name`` option. The :class:`template context
  options)
- ``app_name`` -- the app name as passed to the command
- ``app_directory`` -- the full path of the newly created app
- ``camel_case_app_name`` -- the app name in camel case format
- ``docs_version`` -- the version of the documentation: ``'dev'`` or ``'1.x'``

.. versionadded:: 1.9

    ``camel_case_app_name`` was added.

.. _render_warning:

.. warning::
+3 −0
Original line number Diff line number Diff line
@@ -275,6 +275,9 @@ Management Commands
* The :djadmin:`createcachetable` command now has a ``--dry-run`` flag to
  print out the SQL rather than execute it.

* The :djadmin:`startapp` command creates an ``apps.py`` file and adds
  ``default_app_config`` in ``__init__.py``.

Models
^^^^^^

Loading