Unverified Kaydet (Commit) 0edefa3d authored tarafından Uğur Özyılmazel's avatar Uğur Özyılmazel

Fix: application/__init__.py generation

üst 8e19dafa
![Django](https://img.shields.io/badge/django-2.0.5-green.svg)
![Version](https://img.shields.io/badge/version-0.2.1-yellow.svg)
![Version](https://img.shields.io/badge/version-0.2.2-yellow.svg)
# Django Project Starter Template
......@@ -1509,6 +1509,10 @@ This project is licensed under MIT
## Change Log
**2018-05-08**
- Fix: `application/__init__.py`
**2018-05-07**
- Automatic Django Admin registration changed to: `@admin.register({model_name})` style.
......
......@@ -9,9 +9,12 @@ from django.core.management.base import (
BaseCommand,
CommandError,
)
from django.utils.text import capfirst
from baseapp.management.template_structures import application as application_templates
TEMPLATE_MODELS_INIT = """# from .MODEL_FILE import *
"""
......@@ -20,6 +23,9 @@ TEMPLATE_ADMIN_INIT = """# from .ADMIN_FILE import *
"""
TEMPLATE_APP_INIT = """default_app_config = '{app_name}.apps.{app_name_capfirst}Config'
"""
APP_DIR_STRUCTURE = {
'packages': [
dict(name='admin', files=[
......@@ -34,6 +40,7 @@ APP_DIR_STRUCTURE = {
dict(name='index.html', render=application_templates.TEMPLATE_HTML),
],
'files': [
dict(name='__init__.py', render=TEMPLATE_APP_INIT),
dict(name='apps.py', render=application_templates.TEMPLATE_APPS),
dict(name='urls.py', render=application_templates.TEMPLATE_URLS),
dict(name='views.py', render=application_templates.TEMPLATE_VIEWS),
......@@ -91,6 +98,7 @@ class Command(BaseCommand):
render_params = dict(
app_name_title=app_name.title(),
app_name=app_name,
app_name_capfirst=capfirst(app_name),
)
self.mkdir(new_application_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment