Permalink
Browse files

Laid out the basic frame.

  • Loading branch information...
0 parents commit 556a993f69b16364cdb25ca6333abe93f7aa25c2 @TrevorFSmith committed Jan 6, 2011
Showing with 23,133 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. 0 __init__.py
  3. 0 banana/__init__.py
  4. +9 −0 banana/admin.py
  5. +1 −0 banana/app_media/banana/banana.css
  6. 0 banana/management/__init__.py
  7. 0 banana/management/commands/__init__.py
  8. +47 −0 banana/management/commands/install_demo.py
  9. +34 −0 banana/management/commands/link_media.py
  10. +55 −0 banana/management/commands/make_backup.py
  11. +58 −0 banana/management/commands/restore_backup.py
  12. +73 −0 banana/migrations/0001_initial.py
  13. +74 −0 banana/migrations/0002_auto__add_field_workdoc_modified__add_unique_workdoc_user.py
  14. 0 banana/migrations/__init__.py
  15. +45 −0 banana/models.py
  16. +7 −0 banana/templates/banana/index.html
  17. +24 −0 banana/templates/banana/login.html
  18. +8 −0 banana/templates/banana/user.html
  19. +23 −0 banana/tests.py
  20. +6 −0 banana/urls.py
  21. +37 −0 banana/views.py
  22. +7 −0 context_processors.py
  23. +11 −0 manage.py
  24. +130 −0 media/base/base.css
  25. +1 −0 media/base/base.js
  26. +61 −0 media/base/reset.css
  27. BIN media/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  28. BIN media/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  29. BIN media/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  30. BIN media/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  31. BIN media/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  32. BIN media/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  33. BIN media/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  34. BIN media/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  35. BIN media/jquery/css/smoothness/images/ui-icons_222222_256x240.png
  36. BIN media/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png
  37. BIN media/jquery/css/smoothness/images/ui-icons_454545_256x240.png
  38. BIN media/jquery/css/smoothness/images/ui-icons_888888_256x240.png
  39. BIN media/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png
  40. +312 −0 media/jquery/css/smoothness/jquery-ui-1.8.4.custom.css
  41. +30 −0 media/jquery/development-bundle/AUTHORS.txt
  42. +278 −0 media/jquery/development-bundle/GPL-LICENSE.txt
  43. +25 −0 media/jquery/development-bundle/MIT-LICENSE.txt
  44. +52 −0 media/jquery/development-bundle/demos/addClass/default.html
  45. +18 −0 media/jquery/development-bundle/demos/addClass/index.html
  46. +53 −0 media/jquery/development-bundle/demos/animate/default.html
  47. +18 −0 media/jquery/development-bundle/demos/animate/index.html
  48. +334 −0 media/jquery/development-bundle/demos/demos.css
  49. +107 −0 media/jquery/development-bundle/demos/effect/default.html
  50. +101 −0 media/jquery/development-bundle/demos/effect/easing.html
  51. +24 −0 media/jquery/development-bundle/demos/effect/index.html
  52. +102 −0 media/jquery/development-bundle/demos/hide/default.html
  53. +18 −0 media/jquery/development-bundle/demos/hide/index.html
  54. BIN media/jquery/development-bundle/demos/images/calendar.gif
  55. BIN media/jquery/development-bundle/demos/images/demo-config-on-tile.gif
  56. BIN media/jquery/development-bundle/demos/images/demo-config-on.gif
  57. BIN media/jquery/development-bundle/demos/images/demo-spindown-closed.gif
  58. BIN media/jquery/development-bundle/demos/images/demo-spindown-open.gif
  59. BIN media/jquery/development-bundle/demos/images/icon-docs-info.gif
  60. BIN media/jquery/development-bundle/demos/images/pbar-ani.gif
  61. +313 −0 media/jquery/development-bundle/demos/index.html
  62. +125 −0 media/jquery/development-bundle/demos/position/cycler.html
  63. +159 −0 media/jquery/development-bundle/demos/position/default.html
  64. BIN media/jquery/development-bundle/demos/position/images/earth.jpg
  65. BIN media/jquery/development-bundle/demos/position/images/flight.jpg
  66. BIN media/jquery/development-bundle/demos/position/images/rocket.jpg
  67. +19 −0 media/jquery/development-bundle/demos/position/index.html
  68. +52 −0 media/jquery/development-bundle/demos/removeClass/default.html
  69. +18 −0 media/jquery/development-bundle/demos/removeClass/index.html
  70. +103 −0 media/jquery/development-bundle/demos/show/default.html
  71. +18 −0 media/jquery/development-bundle/demos/show/index.html
  72. +48 −0 media/jquery/development-bundle/demos/switchClass/default.html
  73. +18 −0 media/jquery/development-bundle/demos/switchClass/index.html
  74. +51 −0 media/jquery/development-bundle/demos/tabs/ajax.html
  75. +4 −0 media/jquery/development-bundle/demos/tabs/ajax/content1.html
  76. +4 −0 media/jquery/development-bundle/demos/tabs/ajax/content2.html
  77. +7 −0 media/jquery/development-bundle/demos/tabs/ajax/content3-slow.php
  78. +3 −0 media/jquery/development-bundle/demos/tabs/ajax/content4-broken.php
  79. +60 −0 media/jquery/development-bundle/demos/tabs/bottom.html
  80. +56 −0 media/jquery/development-bundle/demos/tabs/collapsible.html
  81. +57 −0 media/jquery/development-bundle/demos/tabs/cookie.html
  82. +49 −0 media/jquery/development-bundle/demos/tabs/default.html
  83. +25 −0 media/jquery/development-bundle/demos/tabs/index.html
  84. +122 −0 media/jquery/development-bundle/demos/tabs/manipulation.html
  85. +54 −0 media/jquery/development-bundle/demos/tabs/mouseover.html
  86. +65 −0 media/jquery/development-bundle/demos/tabs/sortable.html
  87. +64 −0 media/jquery/development-bundle/demos/tabs/vertical.html
  88. +92 −0 media/jquery/development-bundle/demos/toggle/default.html
  89. +18 −0 media/jquery/development-bundle/demos/toggle/index.html
  90. +46 −0 media/jquery/development-bundle/demos/toggleClass/default.html
  91. +18 −0 media/jquery/development-bundle/demos/toggleClass/index.html
  92. +109 −0 media/jquery/development-bundle/docs/addClass.html
  93. +78 −0 media/jquery/development-bundle/docs/animate.html
  94. +143 −0 media/jquery/development-bundle/docs/effect.html
  95. +144 −0 media/jquery/development-bundle/docs/hide.html
  96. +226 −0 media/jquery/development-bundle/docs/position.html
  97. +113 −0 media/jquery/development-bundle/docs/removeClass.html
  98. +144 −0 media/jquery/development-bundle/docs/show.html
  99. +129 −0 media/jquery/development-bundle/docs/switchClass.html
  100. +1,513 −0 media/jquery/development-bundle/docs/tabs.html
  101. +144 −0 media/jquery/development-bundle/docs/toggle.html
  102. +111 −0 media/jquery/development-bundle/docs/toggleClass.html
  103. +10 −0 media/jquery/development-bundle/external/jquery.bgiframe-2.1.1.js
  104. +89 −0 media/jquery/development-bundle/external/jquery.cookie.js
  105. +122 −0 media/jquery/development-bundle/external/jquery.metadata.js
  106. +148 −0 media/jquery/development-bundle/external/qunit.css
  107. +1,265 −0 media/jquery/development-bundle/external/qunit.js
  108. +6,240 −0 media/jquery/development-bundle/jquery-1.4.2.js
  109. BIN media/jquery/development-bundle/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  110. BIN media/jquery/development-bundle/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  111. BIN media/jquery/development-bundle/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  112. BIN media/jquery/development-bundle/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  113. BIN media/jquery/development-bundle/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  114. BIN media/jquery/development-bundle/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  115. BIN media/jquery/development-bundle/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  116. BIN media/jquery/development-bundle/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  117. BIN media/jquery/development-bundle/themes/base/images/ui-icons_222222_256x240.png
  118. BIN media/jquery/development-bundle/themes/base/images/ui-icons_2e83ff_256x240.png
  119. BIN media/jquery/development-bundle/themes/base/images/ui-icons_454545_256x240.png
  120. BIN media/jquery/development-bundle/themes/base/images/ui-icons_888888_256x240.png
  121. BIN media/jquery/development-bundle/themes/base/images/ui-icons_cd0a0a_256x240.png
  122. +11 −0 media/jquery/development-bundle/themes/base/jquery.ui.all.css
  123. +2 −0 media/jquery/development-bundle/themes/base/jquery.ui.base.css
  124. +41 −0 media/jquery/development-bundle/themes/base/jquery.ui.core.css
  125. +18 −0 media/jquery/development-bundle/themes/base/jquery.ui.tabs.css
  126. +252 −0 media/jquery/development-bundle/themes/base/jquery.ui.theme.css
  127. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  128. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  129. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  130. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  131. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  132. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  133. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  134. BIN media/jquery/development-bundle/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  135. BIN media/jquery/development-bundle/themes/smoothness/images/ui-icons_222222_256x240.png
  136. BIN media/jquery/development-bundle/themes/smoothness/images/ui-icons_2e83ff_256x240.png
  137. BIN media/jquery/development-bundle/themes/smoothness/images/ui-icons_454545_256x240.png
  138. BIN media/jquery/development-bundle/themes/smoothness/images/ui-icons_888888_256x240.png
  139. BIN media/jquery/development-bundle/themes/smoothness/images/ui-icons_cd0a0a_256x240.png
  140. +312 −0 media/jquery/development-bundle/themes/smoothness/jquery-ui-1.8.4.custom.css
  141. +11 −0 media/jquery/development-bundle/themes/smoothness/jquery.ui.all.css
  142. +2 −0 media/jquery/development-bundle/themes/smoothness/jquery.ui.base.css
  143. +41 −0 media/jquery/development-bundle/themes/smoothness/jquery.ui.core.css
  144. +18 −0 media/jquery/development-bundle/themes/smoothness/jquery.ui.tabs.css
  145. +254 −0 media/jquery/development-bundle/themes/smoothness/jquery.ui.theme.css
  146. +2,423 −0 media/jquery/development-bundle/ui/jquery-ui-1.8.4.custom.js
  147. +714 −0 media/jquery/development-bundle/ui/jquery.effects.core.js
  148. +50 −0 media/jquery/development-bundle/ui/jquery.effects.slide.js
  149. +281 −0 media/jquery/development-bundle/ui/jquery.ui.core.js
  150. +151 −0 media/jquery/development-bundle/ui/jquery.ui.mouse.js
  151. +233 −0 media/jquery/development-bundle/ui/jquery.ui.position.js
  152. +757 −0 media/jquery/development-bundle/ui/jquery.ui.tabs.js
  153. +237 −0 media/jquery/development-bundle/ui/jquery.ui.widget.js
  154. +30 −0 media/jquery/development-bundle/ui/minified/jquery.effects.core.min.js
  155. +14 −0 media/jquery/development-bundle/ui/minified/jquery.effects.slide.min.js
  156. +17 −0 media/jquery/development-bundle/ui/minified/jquery.ui.core.min.js
  157. +17 −0 media/jquery/development-bundle/ui/minified/jquery.ui.mouse.min.js
  158. +15 −0 media/jquery/development-bundle/ui/minified/jquery.ui.position.min.js
  159. +35 −0 media/jquery/development-bundle/ui/minified/jquery.ui.tabs.min.js
  160. +15 −0 media/jquery/development-bundle/ui/minified/jquery.ui.widget.min.js
  161. +1 −0 media/jquery/development-bundle/version.txt
  162. +273 −0 media/jquery/index.html
  163. +154 −0 media/jquery/js/jquery-1.4.2.min.js
  164. +144 −0 media/jquery/js/jquery-ui-1.8.4.custom.min.js
  165. BIN media/js/.DS_Store
  166. +328 −0 media/js/dd_belatedpng.js
  167. +28 −0 media/js/modernizr-1.5.min.js
  168. +35 −0 media/js/plugins.js
  169. +26 −0 media/js/script.js
  170. 0 person/__init__.py
  171. +39 −0 person/admin.py
  172. BIN person/app_media/person/BlankIcon150x150.jpg
  173. +21 −0 person/app_media/person/person.css
  174. +17 −0 person/context_processors.py
  175. +70 −0 person/forms.py
  176. +148 −0 person/migrations/0001_initial.py
  177. 0 person/migrations/__init__.py
  178. +156 −0 person/models.py
  179. +5 −0 person/templates/person/email/email_validation.txt
  180. +15 −0 person/templates/person/email/invite.txt
  181. +5 −0 person/templates/person/email/password_reset_email.txt
  182. +13 −0 person/templates/person/email_validate.html
  183. +54 −0 person/templates/person/find_people.html
  184. +5 −0 person/templates/person/index.html
  185. +35 −0 person/templates/person/invite.html
  186. +34 −0 person/templates/person/invites.html
  187. +35 −0 person/templates/person/login.html
  188. +35 −0 person/templates/person/login_popup.html
  189. +13 −0 person/templates/person/password_change.frag
  190. +61 −0 person/templates/person/password_reset.html
  191. +21 −0 person/templates/person/person_info_large.frag
  192. +5 −0 person/templates/person/person_info_list.frag
  193. +30 −0 person/templates/person/person_info_small.frag
  194. +16 −0 person/templates/person/photo_form.frag
  195. +49 −0 person/templates/person/profile.html
  196. +7 −0 person/templates/person/profile_form.frag
  197. +30 −0 person/templates/person/register.html
  198. +7 −0 person/templates/person/registration_form.frag
  199. 0 person/templatetags/__init__.py
  200. +15 −0 person/templatetags/debugtags.py
  201. +165 −0 person/templatetags/imagetags.py
  202. +34 −0 person/templatetags/listtags.py
  203. +1 −0 person/tests/__init__.py
  204. +74 −0 person/tests/test_person.py
  205. +17 −0 person/uploadhandlers.py
  206. +16 −0 person/urls.py
  207. +205 −0 person/views.py
  208. +68 −0 settings.py
  209. +65 −0 templates/base/base.html
  210. +20 −0 urls.py
@@ -0,0 +1,8 @@
+*.pyc
+local_settings.py
+backups
+media/banana
+media/person
+media/resized_image
+media/person_photo
+
No changes.
No changes.
@@ -0,0 +1,9 @@
+from django.contrib import admin
+from django import forms
+from django.forms.util import ErrorList
+
+from models import *
+
+class WorkDocAdmin(admin.ModelAdmin):
+ list_display = ('user', 'modified')
+admin.site.register(WorkDoc, WorkDocAdmin)
@@ -0,0 +1 @@
+/* Banana CSS */
No changes.
No changes.
@@ -0,0 +1,47 @@
+import os
+import time
+import urllib
+import sys
+import random
+from datetime import datetime, date, timedelta
+
+from django.core.management.base import BaseCommand, CommandError
+from django.conf import settings
+from django.contrib.auth.models import User
+from django.core.management import call_command
+from django.contrib.sites.models import Site
+
+class Command(BaseCommand):
+ help = "Installs the demo data."
+ args = "no-reset"
+ requires_model_validation = True
+
+ def handle(self, *labels, **options):
+ from banana.models import WorkDoc
+ if 'no-reset' not in labels:
+ call_command('syncdb', interactive=False)
+ call_command('migrate', interactive=False)
+ call_command('reset', 'banana', interactive=False)
+ for user in User.objects.all(): user.delete()
+
+ site = Site.objects.get_current()
+ site.domain = '127.0.0.1:8000'
+ site.name = 'Transmutable'
+ site.save()
+
+ person1 = self.create_user('trevor', '1234', 'Trevor F.', 'Smith', 'Seattle, WA', is_staff=True, is_superuser=True)
+ person2 = self.create_user('jerry', '1234', 'Jerry', 'Dorfendorf', 'Detroit, MI', is_staff=False, is_superuser=False)
+
+ workdoc1 = person1.work_doc
+ workdoc1.markup = """1. First Item
+2. Second Item
+"""
+ workdoc1.save()
+
+ def create_user(self, username, password, first_name=None, last_name=None, location=None, is_staff=False, is_superuser=False):
+ person, created = User.objects.get_or_create(username=username, first_name=first_name, last_name=last_name, is_staff=is_staff, is_superuser=is_superuser)
+ person.set_password(password)
+ person.save()
+ return person
+
+# Copyright 2010 by 2038 Solutions LLC (http://2038solutions.com/). All Rights Reserved.
@@ -0,0 +1,34 @@
+import os, sys
+import time
+import csv
+import ConfigParser
+
+from django.core.management.base import NoArgsCommand, CommandError
+from django.core.files import File
+from django.core.management.color import color_style
+from django.conf import settings
+
+APP_MEDIA_DIR_NAME = 'app_media'
+
+class Command(NoArgsCommand):
+ help = "Soft links everything in <installed_app>/media/ into <project_root>/media/ DOES NOT WORK ON WINDOWS"
+ requires_model_validation = False
+
+ def handle_noargs(self, **options):
+ for app_name in settings.INSTALLED_APPS: self.link_media_dir(app_name)
+
+ def link_media_dir(self, app_module_name):
+ app = __import__(app_module_name)
+ if '.' in app_module_name: app = sys.modules[app_module_name]
+ app_dir = os.path.dirname(app.__file__)
+
+ app_media = os.path.join(app_dir, APP_MEDIA_DIR_NAME)
+ if not os.path.exists(app_media): return
+
+ for child_name in os.listdir(app_media):
+ source = os.path.join(app_media, child_name)
+ dest = os.path.join(settings.MEDIA_ROOT, child_name)
+ if os.path.exists(dest): continue
+ os.symlink(source, dest) # will not work on windows
+
+# Copyright 2010 by Trevor F. Smith. All Rights Reserved.
@@ -0,0 +1,55 @@
+import os
+import time
+import urllib
+import sys
+import datetime
+
+from django.core.management.base import BaseCommand, CommandError
+from django.conf import settings
+
+class Command(BaseCommand):
+ help = "Creates a backup containing an SQL dump and the non-static media files."
+ args = ""
+ requires_model_validation = False
+
+ def call_system(self, command):
+ print command
+ return os.system(command) == 0
+
+ def handle(self, *labels, **options):
+ if settings.DATABASE_ENGINE != 'postgresql_psycopg2': raise CommandError('This command only works with PostgreSQL')
+ if not hasattr(settings, 'DYNAMIC_MEDIA_DIRS'): raise CommandError('You must define DYNAMIC_MEDIA_DIRS in settings.py')
+ for dir_path in settings.DYNAMIC_MEDIA_DIRS:
+ if not os.path.exists(os.path.join(settings.MEDIA_ROOT, dir_path)): raise CommandError('Specified dynamic media directory "%s" does not exist.' % dir_path)
+ if not os.path.isdir(os.path.join(settings.MEDIA_ROOT, dir_path)): raise CommandError('Specified dynamic media directory "%s" is not a directory.' % dir_path)
+ if not hasattr(settings, 'BACKUP_ROOT'): raise CommandError('You must define BACKUP_ROOT in settings.py')
+ if not os.path.exists(settings.BACKUP_ROOT): raise CommandError('Backup root "%s" does not exist' % settings.BACKUP_ROOT)
+ if not os.path.isdir(settings.BACKUP_ROOT): raise CommandError('Backup root "%s" is not a directory' % settings.BACKUP_ROOT)
+
+ now = datetime.datetime.now()
+ file_token = '%d-%02d-%02d_%02d-%02d-%02d' % (now.year, now.month, now.day, now.hour, now.minute, now.second)
+
+ sql_file = '%s-sql.gz' % file_token
+ sql_path = '%s%s' % (settings.BACKUP_ROOT, sql_file)
+ command = 'pg_dump -U %s %s | gzip > "%s"' % (settings.DATABASE_USER, settings.DATABASE_NAME, sql_path)
+ if not self.call_system(command):
+ print 'aborting'
+ return
+
+ media_file = '%s-media.tgz' % file_token
+ media_path = '%s%s' % (settings.BACKUP_ROOT, media_file)
+ command = 'cd "%s" && tar -czf "%s" %s' % (settings.MEDIA_ROOT, media_path, ' '.join(['"%s"' % media_dir for media_dir in settings.DYNAMIC_MEDIA_DIRS]))
+ if not self.call_system(command):
+ print 'aborting'
+ return
+
+ backup_file = '%s%s-backup.tar' % (settings.BACKUP_ROOT, file_token)
+ command = 'cd "%s" && tar -czf "%s" "%s" "%s"' % (settings.BACKUP_ROOT, backup_file, media_file, sql_file)
+ if not self.call_system(command):
+ print 'aborting'
+ return
+
+ command = 'rm -f "%s" "%s"' % (media_path, sql_path)
+ if not self.call_system(command): print 'Could not erase temp backup files'
+
+# Copyright 2010 by Trevor F. Smith. All Rights Reserved.
@@ -0,0 +1,58 @@
+import os
+import time
+import urllib
+import datetime
+import sys
+import tempfile
+import shutil
+
+from django.core.management.base import BaseCommand, CommandError
+from django.conf import settings
+
+class Command(BaseCommand):
+ help = "Deletes and then restores the DB and non-static media from a backup created using the make_backup management command."
+ args = "[backup_file_path]"
+ requires_model_validation = False
+
+ def call_system(self, command):
+ print command
+ return os.system(command) == 0
+
+ def handle(self, *labels, **options):
+ if settings.DATABASE_ENGINE != 'postgresql_psycopg2': raise CommandError('This command only works with PostgreSQL')
+ if not labels or len(labels) != 1: raise CommandError('Enter one argument, the path to the backup tar file.')
+ backup_path = os.path.realpath(labels[0])
+ if not os.path.exists(backup_path): raise CommandError('The backup file "%s" does not exist.' % backup_path)
+ if not os.path.isfile(backup_path): raise CommandError('The specified backup file "%s" is not a file.' % backup_path)
+ if not backup_path.endswith('.tar'): raise CommandError('The specified backup file "%s" must be a tar file.' % backup_path)
+
+ print 'Restoring from backup file "%s"' % backup_path
+
+ # create the working directory
+ working_dir = tempfile.mkdtemp('backup-temp')
+
+ # untar the backup file, which should result in two files: sql and media
+ command = 'cd "%s" && tar -xzf "%s"' % (working_dir, backup_path)
+ if not self.call_system(command): raise CommandError('Aborting restoration.')
+
+ # create a sub directory for the media, and untar it
+ media_dir = os.path.join(working_dir, 'media')
+ os.mkdir(media_dir)
+ command = 'cd "%s" && tar -xzf %s/*-media.tgz' % (media_dir, working_dir)
+ if not self.call_system(command): raise CommandError('Aborting restoration.')
+
+ # move each media dir from the temp media dir into the project media dir
+ for new_media_dir in os.listdir(media_dir):
+ target_dir = os.path.join(settings.MEDIA_ROOT, new_media_dir)
+ if os.path.exists(target_dir): shutil.rmtree(target_dir)
+ shutil.move(os.path.join(media_dir, new_media_dir), target_dir)
+
+ # now delete and recreate the database
+ command = 'echo "drop database %s; create database %s; grant all on database %s to %s;" | psql -U %s' % (settings.DATABASE_NAME, settings.DATABASE_NAME, settings.DATABASE_NAME, settings.DATABASE_USER, settings.DATABASE_USER)
+ if not self.call_system(command): raise CommandError('Aborting restoration.')
+
+ # now load the SQL into the database
+ command = 'gunzip -c %s/*-sql.gz | psql -U %s %s' % (working_dir, settings.DATABASE_USER, settings.DATABASE_NAME)
+ if not self.call_system(command): raise CommandError('Aborting restoration.')
+
+# Copyright 2010 by Trevor F. Smith. All Rights Reserved.
@@ -0,0 +1,73 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding model 'WorkDoc'
+ db.create_table('banana_workdoc', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='work_docs', to=orm['auth.User'])),
+ ('markup', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('rendered', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ))
+ db.send_create_signal('banana', ['WorkDoc'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'WorkDoc'
+ db.delete_table('banana_workdoc')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'banana.workdoc': {
+ 'Meta': {'ordering': "['user__username']", 'object_name': 'WorkDoc'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'markup': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'rendered': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'work_docs'", 'to': "orm['auth.User']"})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ }
+ }
+
+ complete_apps = ['banana']
@@ -0,0 +1,74 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding field 'WorkDoc.modified'
+ db.add_column('banana_workdoc', 'modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime(2011, 1, 6, 11, 36, 23, 770290), blank=True), keep_default=False)
+
+ # Adding unique constraint on 'WorkDoc', fields ['user']
+ db.create_unique('banana_workdoc', ['user_id'])
+
+
+ def backwards(self, orm):
+
+ # Removing unique constraint on 'WorkDoc', fields ['user']
+ db.delete_unique('banana_workdoc', ['user_id'])
+
+ # Deleting field 'WorkDoc.modified'
+ db.delete_column('banana_workdoc', 'modified')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'banana.workdoc': {
+ 'Meta': {'ordering': "['user__username']", 'object_name': 'WorkDoc'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'markup': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'rendered': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'work_docs'", 'unique': 'True', 'to': "orm['auth.User']"})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ }
+ }
+
+ complete_apps = ['banana']
No changes.
Oops, something went wrong.

0 comments on commit 556a993

Please sign in to comment.