summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornishanth2010-02-12 23:09:11 +0530
committernishanth2010-02-12 23:09:11 +0530
commitae22a79131a2e6decccd0a9542c578d17dbc0000 (patch)
tree78a40f3824dd444a337b3e72cfebb27875206f77
parentf22bacc74ce5be78f8d17f218f4aa39369d54cdb (diff)
downloadpytask-ae22a79131a2e6decccd0a9542c578d17dbc0000.tar.gz
pytask-ae22a79131a2e6decccd0a9542c578d17dbc0000.tar.bz2
pytask-ae22a79131a2e6decccd0a9542c578d17dbc0000.zip
removed seed_db from utils and added it as a command for manage.py and removed url corresponding to seed_db .
-rw-r--r--taskapp/__init__.pycbin142 -> 0 bytes
-rw-r--r--taskapp/admin.pycbin463 -> 0 bytes
-rw-r--r--taskapp/management/__init__.py1
-rw-r--r--taskapp/management/commands/__init__.py (renamed from taskapp/utils/__init__.py)0
-rw-r--r--taskapp/management/commands/seed_db.py (renamed from taskapp/utils/seed_db.py)15
-rw-r--r--urls.py1
6 files changed, 13 insertions, 4 deletions
diff --git a/taskapp/__init__.pyc b/taskapp/__init__.pyc
deleted file mode 100644
index c81884e..0000000
--- a/taskapp/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/taskapp/admin.pyc b/taskapp/admin.pyc
deleted file mode 100644
index b9eb023..0000000
--- a/taskapp/admin.pyc
+++ /dev/null
Binary files differ
diff --git a/taskapp/management/__init__.py b/taskapp/management/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/taskapp/management/__init__.py
@@ -0,0 +1 @@
+
diff --git a/taskapp/utils/__init__.py b/taskapp/management/commands/__init__.py
index e69de29..e69de29 100644
--- a/taskapp/utils/__init__.py
+++ b/taskapp/management/commands/__init__.py
diff --git a/taskapp/utils/seed_db.py b/taskapp/management/commands/seed_db.py
index e472a9e..60b2a56 100644
--- a/taskapp/utils/seed_db.py
+++ b/taskapp/management/commands/seed_db.py
@@ -1,10 +1,14 @@
+import sys
from datetime import datetime
+from django.core.management.base import NoArgsCommand
+
from django.contrib.auth.models import User
-from django.http import HttpResponse
+
from pytask.taskapp.events import task as taskEvents
from pytask.taskapp.events import user as userEvents
-def seed_db(request):
+
+def seed_db():
""" a method to seed the database with random data """
defaultMentor = userEvents.createSuUser("admin", "admin@example.com", "123456", datetime.now(), "M")
@@ -29,5 +33,10 @@ def seed_db(request):
if task:
taskEvents.addMentor(task, defaultMentor)
taskEvents.publishTask(task)
+
+class Command(NoArgsCommand):
+
+ def handle_noargs(self, **options):
+ """ Just copied the code from seed_db.py """
- return HttpResponse("Done")
+ seed_db()
diff --git a/urls.py b/urls.py
index a811fb4..f26d454 100644
--- a/urls.py
+++ b/urls.py
@@ -38,5 +38,4 @@ urlpatterns = patterns('',
(r'^user/edit/?$', userViews.edit_my_profile),
(r'^user/browse/?$', userViews.browse_users),
- (r'^seed_db/$', seed_db),
)