python3! Major work inside

This commit is contained in:
nikolark committed 2016-03-22 16:17:34 +01:00
1 parent 0f6fef809f
commit ce976101a1
34 files changed
+305 -304

No files matched your search

+3 -3
View File
@@ -1,5 +1,5 @@
from django.contrib import admin
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.admin import GenericTabularInline
from bestilling.models import Attachment
from prm.models import PrmOrder
@@ -7,7 +7,7 @@ from tekst.models import TekstOrder
from design.models import DesignOrder
class UploadedFileline(generic.GenericTabularInline):
class UploadedFileline(GenericTabularInline):
model = Attachment
extra = 1
@@ -20,4 +20,4 @@ class OrderAdmin(admin.ModelAdmin):
admin.site.register(PrmOrder, OrderAdmin)
admin.site.register(TekstOrder, OrderAdmin)
admin.site.register(DesignOrder, OrderAdmin)
admin.site.register(Attachment)
admin.site.register(Attachment)
+2 -2
View File
@@ -12,9 +12,9 @@ from django.conf import settings
import trello
from bestilling import utils
from bestilling.models import Attachment
class BaseFormView(TemplateView):
mail_template_name = "confirmation_mail.txt"
mail_from = 'no-reply@studentersamfundet.no'
@@ -79,7 +79,7 @@ class BaseFormView(TemplateView):
board = client.get_board(self.trello_board_id)
all_lists = board.all_lists()
order_list = filter(lambda x: x.name == list_name and (x.fetch() or x.closed == False), all_lists)
order_list = list(filter(lambda x: x.name.decode('utf-8') == list_name and (x.fetch() or x.closed is False), all_lists))
if len(order_list) == 0:
order_list.append(board.add_list(list_name))
+21 -15
View File
@@ -1,20 +1,26 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from __future__ import unicode_literals
from django.db import migrations, models
import bestilling.utils
class Migration(SchemaMigration):
class Migration(migrations.Migration):
def forwards(self, orm):
pass
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
def backwards(self, orm):
pass
models = {
}
complete_apps = ['bestilling']
operations = [
migrations.CreateModel(
name='Attachment',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('uploaded_file', models.FileField(validators=[bestilling.utils.validate_file_extension], upload_to='uploads')),
('trello_id', models.CharField(null=True, max_length=40, blank=True)),
('created', models.DateTimeField(auto_now_add=True)),
('object_id', models.PositiveIntegerField()),
('content_type', models.ForeignKey(to='contenttypes.ContentType')),
],
),
]
@@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Attachment'
db.create_table(u'bestilling_attachment', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('uploaded_file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
('trello_id', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
))
db.send_create_signal(u'bestilling', ['Attachment'])
def backwards(self, orm):
# Deleting model 'Attachment'
db.delete_table(u'bestilling_attachment')
models = {
u'bestilling.attachment': {
'Meta': {'object_name': 'Attachment'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'trello_id': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
'uploaded_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
}
}
complete_apps = ['bestilling']
+6 -4
View File
@@ -1,6 +1,7 @@
import uuid
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from django_extensions.db.fields import UUIDField
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from bestilling.utils import validate_file_extension
@@ -18,11 +19,12 @@ class Attachment(models.Model):
content_type = models.ForeignKey(ContentType, limit_choices_to=_limit_order_choices)
object_id = models.PositiveIntegerField()
order_object = generic.GenericForeignKey('content_type', 'object_id')
order_object = GenericForeignKey('content_type', 'object_id')
class Order(models.Model):
uuid = UUIDField(unique=True, auto=True, version=1) # version 1 guarantees no collisions
# uuid = UUIDField(unique=True, auto=True, version=1) # version 1 guarantees no collisions
uuid = models.UUIDField(unique=True, default=uuid.uuid4) # auto=True, version=1
client = models.CharField(max_length=50)
deadline = models.DateField()
contact_name = models.CharField(max_length=50)
+1 -1
View File
@@ -7,4 +7,4 @@ class AttachmentSerializer(ModelSerializer):
class Meta:
model = Attachment
fields = ('id', 'uploaded_file', 'trello_id', 'object_id', 'content_type')
read_only_fields = ('id',)
read_only_fields = ('id',)
+32 -92
View File
@@ -1,8 +1,6 @@
# Copy and change variables marked with TODO to local_settings.py to make it work.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Path of our project:
BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir))
@@ -10,74 +8,29 @@ BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Trello keys, tokens and board ids
TRELLO_API_KEY = "" # TODO
TRELLO_TOKEN = "" # TODO
TRELLO_DESIGN_BOARD_ID = "" # TODO
TRELLO_TEKST_BOARD_ID = "" # TODO
TRELLO_PRM_BOARD_ID = "" # TODO
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/Oslo'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'nb'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(BASE_DIR, 'static'),
)
@@ -91,17 +44,30 @@ STATICFILES_FINDERS = (
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'asdf123'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
@@ -110,13 +76,6 @@ ROOT_URLCONF = 'bestilling.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'bestilling.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(BASE_DIR, 'templates'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -127,41 +86,22 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.admindocs',
'rest_framework',
'south',
)
INSTALLED_APPS += (
'design',
'tekst',
'prm',
'bestilling'
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
SITE_ID = 1
# Trello keys, tokens and board ids
TRELLO_API_KEY = ""
TRELLO_TOKEN = ""
TRELLO_DESIGN_BOARD_ID = ""
TRELLO_TEKST_BOARD_ID = ""
TRELLO_PRM_BOARD_ID = ""
MAIL_KAK_DESIGN = 'kak-design@studentersamfundet.no'
MAIL_KAK_TEKST = 'kak-tekst@studentersamfundet.no'
@@ -169,9 +109,9 @@ MAIL_KAK_PRM = 'kak-prm@studentersamfundet.no'
UPLOAD_FILENAME_EXTENSIONS_ALLOWED = [
'png', 'ai', 'eps', 'jpeg', 'jpg', 'tif', 'tiff', 'indd', 'webp'
'pdf', 'doc', 'docx', 'xls', 'xlsx', 'txt', 'zip']
'pdf', 'doc', 'docx', 'xls', 'xlsx', 'txt', 'zip', '.gif']
try:
from local_settings import *
from .local_settings import *
except ImportError:
pass
pass
+11 -10
View File
@@ -1,24 +1,25 @@
from django.conf.urls import patterns, include, url
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from bestilling.views import IndexView, AttachmentView
from design import urls as design_urls
from tekst import urls as tekst_urls
from prm import urls as prm_urls
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^design/', include('design.urls')),
url(r'^tekst/', include('tekst.urls')),
url(r'^prm/', include('prm.urls')),
urlpatterns = [
url(r'^design/', include(design_urls)),
url(r'^tekst/', include(tekst_urls)),
url(r'^prm/', include(prm_urls)),
url(r'^$', IndexView.as_view()),
url(r'^attachments/$', AttachmentView.as_view(), name='attachments'),
url(r'^admin/', include(admin.site.urls)),
)
]
if settings.DEBUG:
urlpatterns += patterns(
'',
urlpatterns += [
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT,
}),
)
]
+2 -1
View File
@@ -1,3 +1,4 @@
from __future__ import unicode_literals
import re
from django.core.exceptions import ValidationError
from django.conf import settings
@@ -19,4 +20,4 @@ def validate_file_extension(value):
for ext in settings.UPLOAD_FILENAME_EXTENSIONS_ALLOWED:
if value.name.lower().endswith(ext):
return # bail out
raise ValidationError(u'Ikke tillatt filendelse i "{0}"'.format(value))
raise ValidationError('Ikke tillatt filendelse i "{0}"'.format(value))
+5 -13
View File
@@ -1,7 +1,4 @@
from django.conf import settings
from django.http import HttpResponse
from django.template import Context
from django.template.loader import get_template
from django.views.generic import TemplateView
from rest_framework import generics
@@ -12,20 +9,15 @@ from bestilling.serializers import AttachmentSerializer
class IndexView(TemplateView):
def get(self, request):
template = get_template('index.html')
context_data = {}
response = template.render(Context(context_data))
return HttpResponse(response)
template_name = 'index.html'
class AttachmentView(generics.ListCreateAPIView):
queryset = Attachment.objects.all()
serializer_class = AttachmentSerializer
def post_save(self, obj, created=False):
def perform_create(self, serializer):
obj = serializer.save()
if obj.order_object is not None:
client = trello.TrelloClient(api_key=settings.TRELLO_API_KEY, token=settings.TRELLO_TOKEN)
attachment = client.fetch_json(
@@ -35,4 +27,4 @@ class AttachmentView(generics.ListCreateAPIView):
)
# Persist trello attachment id
obj.trello_id = attachment['id']
obj.save()
obj.save()
+7 -33
View File
@@ -1,41 +1,15 @@
"""
WSGI config for bestilling project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os, sys
from os.path import dirname, join
def map_path(target_name=''):
return join(dirname(__file__), target_name).replace('\\', '/')
path = map_path("..")
if path not in sys.path:
sys.path.append(path)
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "bestilling.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bestilling.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
import os
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bestilling.settings")
application = get_wsgi_application()
+36
View File
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='DesignOrder',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('uuid', django_extensions.db.fields.UUIDField(editable=False, version=1, blank=True, unique=True)),
('client', models.CharField(max_length=50)),
('deadline', models.DateField()),
('contact_name', models.CharField(max_length=50)),
('contact_email', models.CharField(max_length=50)),
('contact_number', models.CharField(null=True, max_length=20, blank=True)),
('created', models.DateTimeField(auto_now_add=True)),
('trello_card_id', models.CharField(max_length=40)),
('format_type', models.CharField(choices=[('Trykk - Flyer', 'Trykk - Flyer'), ('Trykk - Plakat', 'Trykk - Plakat'), ('Trykk - Banner', 'Trykk - Banner'), ('Web - Annonse', 'Web - Annonse'), ('Web - Banner', 'Web - Banner'), ('Web - Bilde', 'Web - Bilde')], max_length=50)),
('paper_size', models.CharField(choices=[('A1', 'A1 (594 x 841 mm)'), ('A2', 'A2 (420 x 594 mm)'), ('B3', 'B3 (353 x 500 mm)'), ('A3', 'A3 (297 x 420 mm)'), ('A4', 'A4 (210 x 297 mm)'), ('A5', 'A5 (148 x 210 mm)'), ('A6', 'A6 (105 x 148 mm)')], max_length=50)),
('colour', models.CharField(max_length=50)),
('marger', models.CharField(max_length=50)),
('content', models.TextField(null=True, blank=True)),
],
options={
'abstract': False,
},
),
]
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('design', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='designorder',
name='uuid',
field=models.UUIDField(unique=True),
),
]
View File
Whitespace-only changes.
+1
View File
@@ -1,6 +1,7 @@
from bestilling.models import Order
from django.db import models
class DesignOrder(Order):
PAPER_SIZES = [
('A1', 'A1 (594 x 841 mm)'),
-15
View File
@@ -1,16 +1 @@
"""
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)
+6 -6
View File
@@ -1,8 +1,8 @@
from django.conf.urls import patterns
from django.conf.urls import url
from design.views import DesignFormView, DesignOrderView
urlpatterns = patterns(
'design.views',
(r'^$', DesignFormView.as_view()),
(r'^order/(?P<order_id>[a-zA-Z0-9-]+)/', DesignOrderView.as_view()),
)
urlpatterns = [
url(r'^$', DesignFormView.as_view()),
url(r'^order/(?P<order_id>[a-zA-Z0-9-]+)/', DesignOrderView.as_view()),
]
+23 -22
View File
@@ -38,17 +38,17 @@ class DesignFormView(BaseFormView):
def _get_errors(self, params):
errors = super(DesignFormView, self)._get_errors(params)
errors.update({
'format_error' : params['format'] == '' or len(params['format']) > 50,
'format_other_error' : params['format'] == 'other' and (params['format_other'] == '' or len(params['format_other']) > 50),
'paper_size_error' : params['paper_size'] == '' or len(params['paper_size']) > 50,
'paper_size_other_error' : params['paper_size'] == 'other' and (params['paper_size_other'] == '' or len(params['paper_size_other']) > 50),
'colour_error' : params['colour'] == '' or len(params['colour']) > 50,
'marger_error' : params['marger'] == '' or len(params['marger']) > 50,
'content_error' : False,
'format_error': params['format'] == '' or len(params['format']) > 50,
'format_other_error': params['format'] == 'other' and (params['format_other'] == '' or len(params['format_other']) > 50),
'paper_size_error': params['paper_size'] == '' or len(params['paper_size']) > 50,
'paper_size_other_error': params['paper_size'] == 'other' and (params['paper_size_other'] == '' or len(params['paper_size_other']) > 50),
'colour_error': params['colour'] == '' or len(params['colour']) > 50,
'marger_error': params['marger'] == '' or len(params['marger']) > 50,
'content_error': False,
})
# Filter out all errors that are False:
return dict((error, True) for error, has_happened in errors.iteritems() if has_happened is True)
return dict((error, True) for error, has_happened in errors.items() if has_happened is True)
def _get_order_url(self, request, order):
return request.build_absolute_uri('/design/order/{uuid}/'.format(uuid=order.uuid))
@@ -60,26 +60,26 @@ class DesignFormView(BaseFormView):
deadline = datetime.strptime(params['deadline'], '%Y-%m-%d')
card = self._save_to_trello(
card_name = params['client'],
card_description = "",
card_name=params['client'],
card_description="",
card_due=datetime.strftime(deadline, '%m/%d/%y'),
)
card_id = card.id
order = DesignOrder(
client = params['client'],
deadline = deadline.date(),
contact_name = params['contact_name'],
contact_email = params['contact_email'],
contact_number = params['contact_number'],
format_type = params['format_type'],
paper_size = params['paper_size'],
colour = params['colour'],
marger = params['marger'],
content = params['content'],
trello_card_id = str(card_id)
)
client=params['client'],
deadline=deadline.date(),
contact_name=params['contact_name'],
contact_email=params['contact_email'],
contact_number=params['contact_number'],
format_type=params['format_type'],
paper_size=params['paper_size'],
colour=params['colour'],
marger=params['marger'],
content=params['content'],
trello_card_id=str(card_id)
)
order.save()
params['url'] = request.build_absolute_uri('/design/order/{uuid}/'.format(uuid=order.uuid))
@@ -89,6 +89,7 @@ class DesignFormView(BaseFormView):
return order
class DesignOrderView(BaseOrderView):
template_name = "design/order.html"
+33
View File
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='PrmOrder',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('uuid', django_extensions.db.fields.UUIDField(editable=False, version=1, blank=True, unique=True)),
('client', models.CharField(max_length=50)),
('deadline', models.DateField()),
('contact_name', models.CharField(max_length=50)),
('contact_email', models.CharField(max_length=50)),
('contact_number', models.CharField(null=True, max_length=20, blank=True)),
('created', models.DateTimeField(auto_now_add=True)),
('trello_card_id', models.CharField(max_length=40)),
('assignment_type', models.CharField(max_length=200)),
('content', models.TextField(null=True, blank=True)),
],
options={
'abstract': False,
},
),
]
+19
View File
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('prm', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='prmorder',
name='uuid',
field=models.UUIDField(unique=True),
),
]
View File
Whitespace-only changes.
-15
View File
@@ -1,16 +1 @@
"""
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)
+5 -6
View File
@@ -1,8 +1,7 @@
from django.conf.urls import patterns
from django.conf.urls import url
from prm.views import PrmFormView, PrmOrderView
urlpatterns = patterns(
'tekst.views',
(r'^$', PrmFormView.as_view()),
(r'^order/(?P<order_id>[a-zA-Z0-9-]+)/', PrmOrderView.as_view()),
)
urlpatterns = [
url(r'^$', PrmFormView.as_view()),
url(r'^order/(?P<order_id>[a-zA-Z0-9-]+)/', PrmOrderView.as_view()),
]
+1 -1
View File
@@ -34,7 +34,7 @@ class PrmFormView(BaseFormView):
})
# Filter out all errors that are False:
return dict((error, True) for error, has_happened in errors.iteritems() if has_happened is True)
return dict((error, True) for error, has_happened in errors.items() if has_happened is True)
def _get_order_url(self, request, order):
return request.build_absolute_uri('/prm/order/{uuid}/'.format(uuid=order.uuid))
+6 -7
View File
@@ -1,7 +1,6 @@
Django>=1.6,<1.7
django-extensions==1.5.2
djangorestframework==2.4.4
mysqlclient==1.3.6
python-dateutil==2.4.2
py-trello==0.1.6
South==1.0.2
Django>=1.8,<1.9
django-extensions==1.6.1
djangorestframework==3.3.3
mysqlclient==1.3.7
python-dateutil==2.5.1
py-trello==0.4.3
+1 -1
View File
@@ -7,7 +7,7 @@ $(function () {
},
dataType: 'json',
done: function (e, data) {
$('.attachments ul').append('<li><a href="/media/' + data.result.uploaded_file + '">'+
$('.attachments ul').append('<li><a href="' + data.result.uploaded_file + '">'+
data.files[0].name + '</a> (ny)</li>');
/* Reset progress */
+37
View File
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='TekstOrder',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('uuid', django_extensions.db.fields.UUIDField(editable=False, version=1, blank=True, unique=True)),
('client', models.CharField(max_length=50)),
('deadline', models.DateField()),
('contact_name', models.CharField(max_length=50)),
('contact_email', models.CharField(max_length=50)),
('contact_number', models.CharField(null=True, max_length=20, blank=True)),
('created', models.DateTimeField(auto_now_add=True)),
('trello_card_id', models.CharField(max_length=40)),
('text_type', models.CharField(max_length=50)),
('length', models.CharField(max_length=50)),
('image', models.CharField(max_length=50)),
('interview_name', models.CharField(max_length=20)),
('interview_contact', models.TextField(null=True, blank=True)),
('content', models.TextField(null=True, blank=True)),
],
options={
'abstract': False,
},
),
]
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tekst', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='tekstorder',
name='uuid',
field=models.UUIDField(unique=True),
),
]
View File
Whitespace-only changes.
+5 -6
View File
@@ -1,8 +1,7 @@
from django.conf.urls import patterns
from django.conf.urls import url
from tekst.views import TekstFormView, TekstOrderView
urlpatterns = patterns(
'tekst.views',
(r'^$', TekstFormView.as_view()),
(r'^order/(?P<order_id>[a-zA-Z0-9-]+)/', TekstOrderView.as_view()),
)
urlpatterns = [
url(r'^$', TekstFormView.as_view()),
url(r'^order/(?P<order_id>[a-zA-Z0-9-]+)/', TekstOrderView.as_view()),
]
+1 -1
View File
@@ -40,7 +40,7 @@ class TekstFormView(BaseFormView):
})
# Filter out all errors that are False:
return dict((error, True) for error, has_happened in errors.iteritems() if has_happened is True)
return dict((error, True) for error, has_happened in errors.items() if has_happened is True)
def _get_order_url(self, request, order):
return request.build_absolute_uri('/tekst/order/{uuid}/'.format(uuid=order.uuid))
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html>
<html>
<head>
<title>Kommunikasjonsavdelingen - Bestillingen er sendt</title>
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>