offline avatar offline committed 38e0af3

more bugfixes to creating project from template

Comments (0)

Files changed (2)


         project_template = Project.objects.get(pk=kwargs['template'])
         for environment in project_template.environments.all():
+            new_environment = copy_to_project(project, environment)
             if environment == project_template.default_environment:
-                project.default_environment = copy_to_project(project, environment)
-            else:
-                copy_to_project(project, environment)
+                project.default_environment = new_environment
-            for task_type in project_template.tasktypes.all():
-                copy_to_project(project, task_type, environment=environment)
+            for task_type in environment.tasktype_set.all():
+                copy_to_project(project, task_type, environment=new_environment)
         for priority in project_template.priorities.all():
+            new_priority = copy_to_project(project, priority)
             if priority == project_template.default_priority:
-                project.default_priority = priority
-            else:
-                copy_to_project(project, priority)
+                project.default_priority = new_priority
         for status in project_template.statuses.all():
             copy_to_project(project, status)
     Copy object to another project
+    obj = copy.deepcopy(obj) = None
     obj.project = project
     for k,v in kwargs.items():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.