Skip to content

Commit

Permalink
Merge pull request #619 from kevgathuku/create-app-template
Browse files Browse the repository at this point in the history
Update app template to create migrations folder if Django>=1.7
  • Loading branch information
trbs committed Feb 12, 2015
2 parents 3f42669 + 4266455 commit 3a9ec26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Empty file.
4 changes: 4 additions & 0 deletions django_extensions/management/commands/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import sys
import django_extensions
from django import VERSION
from django.conf import settings
from django.db import connection
from django.core.management.base import CommandError, LabelCommand
Expand Down Expand Up @@ -73,6 +74,7 @@ def copy_template(app_template, copy_to, project_name, app_name):
"""copies the specified template directory to the copy_to location"""
import shutil

copy_migrations = True if VERSION[:2] >= (1, 7) else False
app_template = os.path.normpath(app_template)
# walks the template structure and copies it
for d, subdirs, files in os.walk(app_template):
Expand All @@ -83,6 +85,8 @@ def copy_template(app_template, copy_to, project_name, app_name):
for i, subdir in enumerate(subdirs):
if subdir.startswith('.'):
del subdirs[i]
elif subdir.startswith('migrations') and not copy_migrations:
del subdirs[i]
replacements = {'app_name': app_name, 'project_name': project_name}
replacements.update(REPLACEMENTS)
for f in files:
Expand Down

0 comments on commit 3a9ec26

Please sign in to comment.