Permalink
Browse files

Import samples from internal git repo

  • Loading branch information...
0 parents commit b1895d3f9c9247a6fb48728d055395295c852d09 Sridhar Ratnakumar committed May 19, 2011
Showing with 1,734 additions and 0 deletions.
  1. +19 −0 README.md
  2. +14 −0 README.txt
  3. 0 __init__.py
  4. 0 gtd/__init__.py
  5. +68 −0 gtd/admin.py
  6. 0 gtd/feeds.py
  7. 0 gtd/forms.py
  8. 0 gtd/management/__init__.py
  9. 0 gtd/management/commands/__init__.py
  10. +9 −0 gtd/management/commands/reminders.py
  11. +30 −0 gtd/managers.py
  12. +116 −0 gtd/migrations/0001_initial.py
  13. +78 −0 gtd/migrations/0002_auto__add_field_context_slug__add_field_context_parent__add_field_proj.py
  14. +65 −0 gtd/migrations/0003_auto__del_field_context_parent.py
  15. 0 gtd/migrations/__init__.py
  16. +245 −0 gtd/models.py
  17. +3 −0 gtd/templates/gtd/admin/reminders.html
  18. 0 gtd/templatetags/__init__.py
  19. +12 −0 gtd/tests.py
  20. +11 −0 gtd/urls.py
  21. +35 −0 gtd/utils.py
  22. 0 gtd/validators.py
  23. +6 −0 gtd/views/__init__.py
  24. 0 gtd/views/calendar.py
  25. +50 −0 gtd/views/dashboard.py
  26. +26 −0 gtd/views/objects.py
  27. 0 gtd/views/reports.py
  28. +11 −0 manage.py
  29. +3 −0 requirements.txt
  30. +128 −0 settings.py
  31. +18 −0 static/admin/css/changelist.css
  32. +53 −0 static/css/reset.css
  33. +483 −0 static/css/styles.css
  34. BIN static/img/favicon.png
  35. BIN static/img/sprite.png
  36. BIN static/img/sprite.xcf
  37. 0 templates/gtd/context_detail.html
  38. 0 templates/gtd/context_list.html
  39. +139 −0 templates/gtd/dashboard.html
  40. 0 templates/gtd/project_detail.html
  41. 0 templates/gtd/project_list.html
  42. +21 −0 templates/gtd/status_icons.html
  43. 0 templates/gtd/thing_detail.html
  44. 0 templates/gtd/thing_list.html
  45. +17 −0 templates/gtd/thing_list_item.html
  46. +19 −0 templates/layouts/base.html
  47. +21 −0 templates/registration/login.html
  48. +26 −0 urls.py
  49. +8 −0 wsgi.py
@@ -0,0 +1,19 @@
+# Django GTD application
+
+## Local development
+
+ pypm install -r requirements.txt
+ python manage.py syncdb
+ python manage.py migrate
+ python manager.py runserver
+
+## Deploying to Stackato
+
+ stackato push django-gtd
+ stackato run "python manage.py syncdb --noinput"
+ stackato run "python manage.py migrate --noinput"
+
+### Limitations
+
+Django admin's superuser creation cannot be automated (note:
+``--noinput``), so /admin/ is unusable for this app.
@@ -0,0 +1,14 @@
+Deploying to Stackato
+=====================
+
+1. ``vmc push djangogtd`` (add a mysql service)
+
+2. Initialize the db::
+
+ vmc run djangogtd "python manage.py syncdb --noinput"
+ vmc run djangogtd "python manage.py migrate --noinput"
+
+3. # XXX: can't run `manage.py createsuperuser --noinput` as it
+ doesn't set a password
+
+4. Open the djangogtd URL, you should see the app albeit with empty data.
No changes.
No changes.
@@ -0,0 +1,68 @@
+from django.contrib import admin
+from django.contrib import databrowse
+from gtd.models import Thing, Project, Context, Reminder
+from django import forms
+
+class ReminderInline(admin.TabularInline):
+ model = Reminder
+ extra = 0
+
+class ThingAdmin(admin.ModelAdmin):
+ date_hierarchy = 'created'
+ list_display = ('get_name', 'get_context', 'get_project', 'get_progress',
+ 'status', 'get_reminders', 'get_created')
+ list_display_link = ('get_name', 'status')
+ list_filter = ('context', 'project', 'schedule','status', 'deleted', 'archived', )
+ list_editable = ('status', )
+ search_fields = ['name', 'description']
+ inlines = [ReminderInline,]
+ select_related = True
+
+ class Media:
+ css = {"all": ("admin/css/changelist.css",)}
+
+class ThingModelForm(forms.ModelForm):
+ class Meta:
+ model = Thing
+ fields = ('name', 'context', 'progress', 'status', 'project', 'deleted', 'archived')
+
+class ThingInline(admin.TabularInline):
+ model = Thing
+ form = ThingModelForm
+
+class ProjectAdmin(admin.ModelAdmin):
+ date_hierarchy = 'created'
+ list_display = ('name', 'active', 'thing_count', 'thing_todo_count', 'thing_done_count', 'get_progress_bar', 'get_deadline')
+ list_filter = ('active', 'deadline')
+ list_editable = ('active', )
+ search_fields = ['name', 'description']
+ inlines = [ThingInline,]
+ prepopulated_fields = {'slug': ('name',)}
+ fieldsets = (
+ (None, {
+ 'fields': ('name', 'slug', 'deadline', 'get_progress', 'description', 'active')
+ }),
+ )
+ readonly_fields = ['get_progress',]
+
+ class Media:
+ css = {"all": ("admin/css/changelist.css",)}
+
+class ContextAdmin(admin.ModelAdmin):
+ list_display = ('__unicode__', 'thing_count', 'thing_todo_count', 'thing_done_count')
+ prepopulated_fields = {'slug': ('name',)}
+ inlines = [ThingInline,]
+
+class ReminderAdmin(admin.ModelAdmin):
+ list_display = ('__unicode__', 'countdown')
+ list_filter = ('method',)
+ search_fields = ['thing__name', 'thing__description']
+
+admin.site.register(Thing, ThingAdmin)
+admin.site.register(Project, ProjectAdmin)
+admin.site.register(Context, ContextAdmin)
+admin.site.register(Reminder, ReminderAdmin)
+databrowse.site.register(Thing)
+databrowse.site.register(Project)
+databrowse.site.register(Context)
+databrowse.site.register(Reminder)
No changes.
No changes.
No changes.
No changes.
@@ -0,0 +1,9 @@
+from django.core.management.base import BaseCommand, CommandError
+from gtd.models import Reminder
+
+class Command(BaseCommand):
+ help = 'Execute action reminders'
+
+ def handle(self, *args, **options):
+ for reminder in Reminder.objects.all():
+ print u'%s' % reminder
@@ -0,0 +1,30 @@
+from django.db import models
+
+class FocusManager(models.Manager):
+ def get_query_set(self):
+ return super(FocusManager, self).get_query_set().filter(deleted=False)
+
+ def today(self, queryset):
+ pass
+
+ def tomorrow(self, queryset):
+ pass
+
+ def overdue(self, queryset):
+ pass
+
+ def executable(self, queryset):
+ pass
+
+ def following(self, queryset):
+ pass
+
+ def delegated(self, queryset):
+ pass
+
+ def deferred(self, queryset):
+ pass
+
+ def incubated(self, queryset):
+ pass
+
@@ -0,0 +1,116 @@
+# 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 'Project'
+ db.create_table('gtd_project', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=90)),
+ ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ('active', self.gf('django.db.models.fields.BooleanField')(default=True, blank=True)),
+ ('deadline', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+ ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+ ('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
+ ))
+ db.send_create_signal('gtd', ['Project'])
+
+ # Adding model 'Context'
+ db.create_table('gtd_context', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=90)),
+ ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ))
+ db.send_create_signal('gtd', ['Context'])
+
+ # Adding model 'Thing'
+ db.create_table('gtd_thing', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=140)),
+ ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ('status', self.gf('django.db.models.fields.IntegerField')(default=1)),
+ ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gtd.Project'], null=True, blank=True)),
+ ('context', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gtd.Context'])),
+ ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
+ ('archived', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
+ ('progress', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ('schedule', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+ ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+ ('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
+ ))
+ db.send_create_signal('gtd', ['Thing'])
+
+ # Adding model 'Reminder'
+ db.create_table('gtd_reminder', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('thing', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gtd.Thing'])),
+ ('number', self.gf('django.db.models.fields.IntegerField')()),
+ ('unit', self.gf('django.db.models.fields.IntegerField')(default=3)),
+ ('method', self.gf('django.db.models.fields.IntegerField')(default=1)),
+ ))
+ db.send_create_signal('gtd', ['Reminder'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'Project'
+ db.delete_table('gtd_project')
+
+ # Deleting model 'Context'
+ db.delete_table('gtd_context')
+
+ # Deleting model 'Thing'
+ db.delete_table('gtd_thing')
+
+ # Deleting model 'Reminder'
+ db.delete_table('gtd_reminder')
+
+
+ models = {
+ 'gtd.context': {
+ 'Meta': {'object_name': 'Context'},
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '90'})
+ },
+ 'gtd.project': {
+ 'Meta': {'object_name': 'Project'},
+ 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deadline': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '90'})
+ },
+ 'gtd.reminder': {
+ 'Meta': {'object_name': 'Reminder'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'method': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'number': ('django.db.models.fields.IntegerField', [], {}),
+ 'thing': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Thing']"}),
+ 'unit': ('django.db.models.fields.IntegerField', [], {'default': '3'})
+ },
+ 'gtd.thing': {
+ 'Meta': {'object_name': 'Thing'},
+ 'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'context': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Context']"}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '140'}),
+ 'progress': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Project']", 'null': 'True', 'blank': 'True'}),
+ 'schedule': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'status': ('django.db.models.fields.IntegerField', [], {'default': '1'})
+ }
+ }
+
+ complete_apps = ['gtd']
@@ -0,0 +1,78 @@
+# 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 'Context.slug'
+ db.add_column('gtd_context', 'slug', self.gf('django.db.models.fields.SlugField')(default='', max_length=50, db_index=True), keep_default=False)
+
+ # Adding field 'Context.parent'
+ db.add_column('gtd_context', 'parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gtd.Context'], null=True, blank=True), keep_default=False)
+
+ # Adding field 'Project.slug'
+ db.add_column('gtd_project', 'slug', self.gf('django.db.models.fields.SlugField')(default='', max_length=50, db_index=True), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'Context.slug'
+ db.delete_column('gtd_context', 'slug')
+
+ # Deleting field 'Context.parent'
+ db.delete_column('gtd_context', 'parent_id')
+
+ # Deleting field 'Project.slug'
+ db.delete_column('gtd_project', 'slug')
+
+
+ models = {
+ 'gtd.context': {
+ 'Meta': {'object_name': 'Context'},
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '90'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Context']", 'null': 'True', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'gtd.project': {
+ 'Meta': {'object_name': 'Project'},
+ 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deadline': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '90'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'gtd.reminder': {
+ 'Meta': {'object_name': 'Reminder'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'method': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'number': ('django.db.models.fields.IntegerField', [], {}),
+ 'thing': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Thing']"}),
+ 'unit': ('django.db.models.fields.IntegerField', [], {'default': '3'})
+ },
+ 'gtd.thing': {
+ 'Meta': {'object_name': 'Thing'},
+ 'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'context': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Context']"}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '140'}),
+ 'progress': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gtd.Project']", 'null': 'True', 'blank': 'True'}),
+ 'schedule': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'status': ('django.db.models.fields.IntegerField', [], {'default': '1'})
+ }
+ }
+
+ complete_apps = ['gtd']
Oops, something went wrong.

0 comments on commit b1895d3

Please sign in to comment.