Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
authorNishanth <nishanth@fossee.in>
Sun, 24 Jan 2010 15:43:19 +0530
changeset 1 7818992cbf83
parent 0 a87d642f1ba5
child 2 daeb3985912d
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
__init__.pyc
settings.py
settings.pyc
taskapp/__init__.py
taskapp/__init__.pyc
taskapp/admin.py
taskapp/admin.pyc
taskapp/models.py
taskapp/models.pyc
taskapp/tests.py
taskapp/views.py
urls.py
urls.pyc
Binary file __init__.pyc has changed
--- a/settings.py	Sun Jan 24 13:47:05 2010 +0530
+++ b/settings.py	Sun Jan 24 15:43:19 2010 +0530
@@ -9,8 +9,8 @@
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = ''             # Or path to database file if using sqlite3.
+DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = 'appDb'             # Or path to database file if using sqlite3.
 DATABASE_USER = ''             # Not used with sqlite3.
 DATABASE_PASSWORD = ''         # Not used with sqlite3.
 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
@@ -76,4 +76,6 @@
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
+    'django.contrib.admin',
+    'pytask.taskapp',
 )
Binary file settings.pyc has changed
Binary file taskapp/__init__.pyc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskapp/admin.py	Sun Jan 24 15:43:19 2010 +0530
@@ -0,0 +1,7 @@
+from pytask.taskapp.models import Person,Task,Comment,Credit
+from django.contrib import admin
+
+admin.site.register(Person)
+admin.site.register(Task)
+admin.site.register(Comment)
+admin.site.register(Credit)
Binary file taskapp/admin.pyc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskapp/models.py	Sun Jan 24 15:43:19 2010 +0530
@@ -0,0 +1,94 @@
+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"),
+	("MT", "Mentor"),
+	("CT", "Contributor"),
+	("GP", "Public"),)
+
+STATUS_CHOICES = (
+	("OP", "Open"),
+	("CL", "Claimed"),
+	("LO", "Locked"),
+	("AS", "Assigned"),)
+
+IMAGES_DIR = "./images"
+UPLOADS_DIR = "./uploads"
+
+class Person(models.Model):
+#class Person(User):
+	
+    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)
+    
+    parents = 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('Person', related_name = "%(class)s_mentors")
+    created_by = models.ForeignKey('Person', related_name = "%(class)s_created_by")
+    claimed_users = models.ManyToManyField('Person', blank = True, related_name = "%(class)s_claimed_users")
+    assigned_users = models.ManyToManyField('Person', blank = True, related_name = "%(class)s_assigned_users")
+    
+    creation_date = models.DateField()
+    
+    ## 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('Person', related_name = "%(class)s_created_by")
+    deleted_by = models.ForeignKey('Person', null = True, blank = True, related_name = "%(class)s_deleted_by")
+    creation_date = models.DateField()
+    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('Person', related_name = "%(class)s_given_by")
+    given_to = models.ForeignKey('Person', related_name = "%(class)s_given_to")
+    points = models.PositiveSmallIntegerField()
+    
+    def __unicode__(self):
+        return unicode(self.task.title)
+    
Binary file taskapp/models.pyc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskapp/tests.py	Sun Jan 24 15:43:19 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/taskapp/views.py	Sun Jan 24 15:43:19 2010 +0530
@@ -0,0 +1,1 @@
+# Create your views here.
--- a/urls.py	Sun Jan 24 13:47:05 2010 +0530
+++ b/urls.py	Sun Jan 24 15:43:19 2010 +0530
@@ -1,8 +1,8 @@
 from django.conf.urls.defaults import *
 
 # Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
+from django.contrib import admin
+admin.autodiscover()
 
 urlpatterns = patterns('',
     # Example:
@@ -13,5 +13,5 @@
     # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
     # Uncomment the next line to enable the admin:
-    # (r'^admin/', include(admin.site.urls)),
+    (r'^admin/', include(admin.site.urls)),
 )
Binary file urls.pyc has changed