From a5ad132ccfe5fd4fd87b559a5bfc0a75c57152c2 Mon Sep 17 00:00:00 2001 From: Seth Woodworth Date: Tue, 27 Aug 2013 09:39:12 -0400 Subject: [PATCH] add django-filepicker and a document_upload app for the new document upload workflow --- karmaworld/apps/document_upload/__init__.py | 0 karmaworld/apps/document_upload/models.py | 27 +++++++++++++++++++++ karmaworld/apps/document_upload/tests.py | 16 ++++++++++++ karmaworld/apps/document_upload/views.py | 1 + karmaworld/settings/common.py | 3 ++- reqs/common.txt | 5 ++-- 6 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 karmaworld/apps/document_upload/__init__.py create mode 100644 karmaworld/apps/document_upload/models.py create mode 100644 karmaworld/apps/document_upload/tests.py create mode 100644 karmaworld/apps/document_upload/views.py diff --git a/karmaworld/apps/document_upload/__init__.py b/karmaworld/apps/document_upload/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/karmaworld/apps/document_upload/models.py b/karmaworld/apps/document_upload/models.py new file mode 100644 index 0000000..63f19f9 --- /dev/null +++ b/karmaworld/apps/document_upload/models.py @@ -0,0 +1,27 @@ +import datetime + +from django.db import models + +import django_filepicker + +class IntakeDoc(models.Model): + fp_note = django_filepicker.models.FPFileField(upload_to='queue/%Y/%m/%j/', + help_text=u"An uploaded file reference from Filepicker.io") + form = models.TextField(max_length=1024, + help_text=u"A serilized version of the note data form") + ip = models.IPAddressField(blank=True, null=True, + help_text=u"IP address of the uploader") + + uploaded_at = models.DateTimeField(null=True, default=datetime.datetime.utcnow) + + class Meta: + """ Sort files most recent first """ + ordering = ['-uploaded_at'] + + + def __unicode__(self): + return u"{0} @ {1}".format(self.ip, self.uploaded_at) + + def convert_to_note(self): + """ polymorph this object into a note.models.Note object """ + pass diff --git a/karmaworld/apps/document_upload/tests.py b/karmaworld/apps/document_upload/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/karmaworld/apps/document_upload/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this 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.assertEqual(1 + 1, 2) diff --git a/karmaworld/apps/document_upload/views.py b/karmaworld/apps/document_upload/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/karmaworld/apps/document_upload/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/karmaworld/settings/common.py b/karmaworld/settings/common.py index 1adc653..078d3a8 100644 --- a/karmaworld/settings/common.py +++ b/karmaworld/settings/common.py @@ -72,7 +72,7 @@ TIME_ZONE = 'America/New_York' LANGUAGE_CODE = 'en-us' # See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id -SITE_ID = 1 +SITE_ID = 2 # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n USE_I18N = True @@ -209,6 +209,7 @@ LOCAL_APPS = ( 'karmaworld.apps.notes', 'karmaworld.apps.courses', 'karmaworld.apps.ajaxuploader', + 'karmaworld.apps.document_upload', ) # See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps diff --git a/reqs/common.txt b/reqs/common.txt index 2a42a6b..fbfe11c 100644 --- a/reqs/common.txt +++ b/reqs/common.txt @@ -1,13 +1,14 @@ Django>=1.4.0,<=1.4.9 -django-celery==3.0.11 +django-celery==3.0.21 django-compressor==1.2 Fabric==1.5.3 South==0.7.6 Sphinx==1.1.3 supervisor==3.0b1 -git+git://github.com/FinalsClub/django-taggit.git oauth2client==1.0 urllib3==1.5 google-api-python-client==1.0 django-grappelli==2.4.3 lxml==3.1.0 +git+https://github.com/FinalsClub/django-taggit.git +django-filepicker==0.1.4 -- 2.25.1