added an app called taskapp and created the models.
--- a/pytask/settings.py Thu Jan 28 19:17:31 2010 +0530
+++ b/pytask/settings.py Thu Jan 28 20:26:54 2010 +0530
@@ -81,4 +81,4 @@
'pytask.taskapp',
)
-AUTH_PROFILE_MODULE = 'taskapp.Profile'
+AUTH_PROFILE_MODULE = 'taskapp.models.user.Profile'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/taskapp/admin.py Thu Jan 28 20:26:54 2010 +0530
@@ -0,0 +1,11 @@
+from django.contrib import admin
+
+from pytask.taskapp.models.user import Profile
+from pytask.taskapp.models.task import Task
+from pytask.taskapp.models.credit import Credit
+from pytask.taskapp.models.comment import Comment
+
+admin.site.register(Profile)
+admin.site.register(Task)
+admin.site.register(Comment)
+admin.site.register(Credit)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/taskapp/models.py Thu Jan 28 20:26:54 2010 +0530
@@ -0,0 +1,96 @@
+from django.db import models
+from django.contrib.auth.models import User
+
+GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
+RIGHTS_CHOICES = (
+ ("AD", "Admin"),
+ ("MN", "Manager"),
+ ("DV", "Developer"),
+ ("CT", "Contributor"),)
+
+STATUS_CHOICES = (
+ ("OP", "Open"),
+ ("LO", "Locked"),
+ ("CL", "Claimed"),
+ ("AS", "Assigned"),
+ ("RO", "Reopened"),
+ ("CD", "Closed"),
+ ("DL", "Deleted"),
+ ("CM", "Completed"))
+
+IMAGES_DIR = "./images"
+UPLOADS_DIR = "./uploads"
+
+class Profile(models.Model):
+
+ user = models.ForeignKey(User, unique = True)
+ aboutme = models.TextField()
+ dob = models.DateField()
+ gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
+ rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES)
+ credits = models.PositiveSmallIntegerField()
+
+ foss_comm = models.CharField(max_length = 80, blank = True)
+ phonenum = models.CharField(max_length = 15, blank = True)
+ homepage = models.URLField(blank = True)
+ street = models.CharField(max_length = 80, blank = True)
+ city = models.CharField(max_length = 25, blank = True)
+ country = models.CharField(max_length = 25, blank = True)
+ nick = models.CharField(max_length = 20, blank = True)
+# photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
+
+ def __unicode__(self):
+ return unicode(self.user.username)
+
+
+class Task(models.Model):
+
+ title = models.CharField(max_length = 200, unique = True)
+ desc = models.TextField()
+ status = models.CharField(max_length = 2, choices = STATUS_CHOICES)
+ tags = models.CharField(max_length = 200, blank = True)
+
+ subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
+ deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps")
+
+ credits = models.PositiveSmallIntegerField()
+ progress = models.PositiveSmallIntegerField()
+
+ mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors")
+ created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
+ claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users")
+ assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users")
+
+ creation_datetime = models.DateTimeField()
+
+ ## not yet decided if attribs after this are to be included
+ ## tasktype = "" ## "bugfix"/"enhancement"
+ ## priority = "" ## "very urgent"/"urgent"
+
+ def __unicode__(self):
+ return unicode(self.title)
+
+class Comment(models.Model):
+
+ task = models.ForeignKey('Task')
+ data = models.TextField()
+ created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
+ creation_datetime = models.DateTimeField()
+# deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by")
+# deleted = models.BooleanField()
+# attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
+
+ def __unicode__(self):
+ return unicode(self.task.title)
+
+class Credit(models.Model):
+
+ task = models.ForeignKey('Task')
+ given_by = models.ForeignKey(User, related_name = "%(class)s_given_by")
+ given_to = models.ForeignKey(User, related_name = "%(class)s_given_to")
+ points = models.PositiveSmallIntegerField()
+ given_time = models.DateTimeField()
+
+ def __unicode__(self):
+ return unicode(self.task.title)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/taskapp/tests.py Thu Jan 28 20:26:54 2010 +0530
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/taskapp/views/__init__.py Thu Jan 28 20:26:54 2010 +0530
@@ -0,0 +1,1 @@
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/taskapp/views/users.py Thu Jan 28 20:26:54 2010 +0530
@@ -0,0 +1,1 @@
+
--- a/pytask/urls.py Thu Jan 28 19:17:31 2010 +0530
+++ b/pytask/urls.py Thu Jan 28 20:26:54 2010 +0530
@@ -4,9 +4,6 @@
from django.contrib import admin
admin.autodiscover()
-from pytask.taskapp.seed_db import seed_db
-from pytask.taskapp import views
-
urlpatterns = patterns('',
# Example:
# (r'^pytask/', include('pytask.foo.urls')),
@@ -14,16 +11,7 @@
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
- (r'^$', views.homepage),
- (r'^accounts/logout/?$', views.logout_user),
- (r'^accounts/login/?$', views.login_user),
- (r'^accounts/register/?$', views.register_user),
- #(r'^user/view?uid=(\d+)$', views.view_profile),
- #(r'^user/edit/?$', views.edit_profile),
- #(r'^user/view/?$', views.browse_users),
(r'^admin/', include(admin.site.urls)),
- (r'^seed_db/?$',seed_db),
)