Permalink
Browse files

Much work on the submissions. Committing so people can get eyes on wh…

…at I've done
  • Loading branch information...
1 parent 86b788f commit ff9104417d6c16322042f87d181da6247fbe0a71 @rossbruniges rossbruniges committed Nov 20, 2012
View
@@ -18,3 +18,4 @@ build
tmp/*
*~
*.mo
+media/submission-entry/
@@ -0,0 +1,56 @@
+fieldset {
+ border: none;
+ padding: 0;
+ margin: 0;
+}
+legend {
+ position: relative;
+ margin-top: -2em;
+}
+legend span {
+ position: relative;
+ left: -9999em;
+ height: 1px;
+ overflow: hidden;
+ margin-top: -1em;
+}
+label {
+ display: inline-block;
+ margin: 0 10px 0.3em 0;
+ cursor: pointer;
+}
+input[type=text],
+textarea {
+ width: 100%;
+}
+textarea {
+ height: 100px;
+}
+.form_wrapper {
+ border: 1px solid #ccc;
+ background: #f0f0f0;
+ margin-bottom: 1em;
+ border-radius: 8px;
+}
+.form_wrapper ul {
+ list-style-type: none;
+ padding-left: 0;
+ margin-left: 0;
+}
+.field {
+ padding: 2em 40px;
+ border-top: 1px solid #ccc;
+}
+.first-field {
+ border-top: none;
+}
+.submit_row {
+ background: #000;
+ text-align: left;
+ color: #fff;
+ font-weight: bold;
+}
+.submit_row input {
+ text-transform: uppercase;
+ margin-left: 20px;
+}
View
@@ -0,0 +1,15 @@
+import datetime
+import hashlib
+import os
+
+
+def _upload_path(tag):
+ def _upload_path_tagged(instance, filename):
@toolness
toolness Nov 26, 2012 Contributor

I assume django ensures that filename is sanitized when it's calling this function. If not, that would be dumb.

+ now = datetime.datetime.now()
+ path = os.path.join(now.strftime('%Y'), now.strftime('%m'),
+ now.strftime('%d'))
+ hashed_filename = (hashlib.md5(filename +
+ str(now.microsecond)).hexdigest())
+ __, extension = os.path.splitext(filename)
+ return os.path.join(tag, path, hashed_filename + extension)
+ return _upload_path_tagged
@@ -1,10 +1,25 @@
from django import forms
+from django.forms.models import ModelChoiceField
+from django.forms.widgets import CheckboxSelectMultiple
-from gameon.submissions.models import Entry
+from gameon.submissions.models import Entry, Category
+
+MARKET_CHOICES = (('True', 'Yes, I want to submit by game to the marketplace'),
+ ('False', "No, I don't want to submit my game to the marketplace"))
+
+entry_widgets = {
+ 'to_market': forms.RadioSelect(choices=MARKET_CHOICES),
+}
class EntryForm(forms.ModelForm):
+ category = ModelChoiceField(queryset=Category.objects.all(),
+ empty_label=None, widget=CheckboxSelectMultiple)
+
class Meta:
model = Entry
- fields = ('title', 'url', 'description', 'category')
+ fields = ('title', 'url', 'description', 'category', 'thumbnail',
+ 'video_url', 'team_name', 'team_members', 'team_desciption',
+ 'to_market')
+ widgets = entry_widgets
@@ -8,6 +8,16 @@
class Migration(SchemaMigration):
def forwards(self, orm):
+ # Adding model 'Challenge'
+ db.create_table('submissions_challenge', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200)),
+ ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100)),
+ ('start_date', self.gf('django.db.models.fields.DateTimeField')()),
+ ('end_date', self.gf('django.db.models.fields.DateTimeField')()),
+ ))
+ db.send_create_signal('submissions', ['Challenge'])
+
# Adding model 'Category'
db.create_table('submissions_category', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -22,13 +32,20 @@ def forwards(self, orm):
('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=255)),
('url', self.gf('django.db.models.fields.URLField')(max_length=255)),
- ('description', self.gf('django.db.models.fields.TextField')()),
- ('category', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['submissions.Category'], unique=True)),
+ ('thumbnail', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
+ ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['users.Profile'], null=True, blank=True)),
+ ('video_url', self.gf('django.db.models.fields.URLField')(default='http://webmaker.org', max_length=255)),
+ ('description', self.gf('django.db.models.fields.TextField')(default='foo')),
+ ('category', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['submissions.Category'], null=True, blank=True)),
+ ('to_market', self.gf('django.db.models.fields.BooleanField')(default=False)),
))
db.send_create_signal('submissions', ['Entry'])
def backwards(self, orm):
+ # Deleting model 'Challenge'
+ db.delete_table('submissions_challenge')
+
# Deleting model 'Category'
db.delete_table('submissions_category')
@@ -37,20 +54,73 @@ def backwards(self, orm):
models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ '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'}),
+ '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'})
+ },
'submissions.category': {
'Meta': {'object_name': 'Category'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'})
},
+ 'submissions.challenge': {
+ 'Meta': {'object_name': 'Challenge'},
+ 'end_date': ('django.db.models.fields.DateTimeField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}),
+ 'start_date': ('django.db.models.fields.DateTimeField', [], {})
+ },
'submissions.entry': {
'Meta': {'object_name': 'Entry'},
- 'category': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['submissions.Category']", 'unique': 'True'}),
- 'description': ('django.db.models.fields.TextField', [], {}),
+ 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['submissions.Category']", 'null': 'True', 'blank': 'True'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['users.Profile']", 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'default': "'foo'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
+ 'thumbnail': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
- 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
+ 'to_market': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'}),
+ 'video_url': ('django.db.models.fields.URLField', [], {'default': "'http://webmaker.org'", 'max_length': '255'})
+ },
+ 'users.profile': {
+ 'Meta': {'object_name': 'Profile'},
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
}
}
@@ -1,53 +0,0 @@
-# -*- coding: 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 'Challenge'
- db.create_table('submissions_challenge', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200)),
- ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100)),
- ('start_date', self.gf('django.db.models.fields.DateTimeField')()),
- ('end_date', self.gf('django.db.models.fields.DateTimeField')()),
- ))
- db.send_create_signal('submissions', ['Challenge'])
-
-
- def backwards(self, orm):
- # Deleting model 'Challenge'
- db.delete_table('submissions_challenge')
-
-
- models = {
- 'submissions.category': {
- 'Meta': {'object_name': 'Category'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
- 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'submissions.challenge': {
- 'Meta': {'object_name': 'Challenge'},
- 'end_date': ('django.db.models.fields.DateTimeField', [], {}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
- 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}),
- 'start_date': ('django.db.models.fields.DateTimeField', [], {})
- },
- 'submissions.entry': {
- 'Meta': {'object_name': 'Entry'},
- 'category': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['submissions.Category']", 'unique': 'True'}),
- 'description': ('django.db.models.fields.TextField', [], {}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
- 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
- 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
- }
- }
-
- complete_apps = ['submissions']
Oops, something went wrong.

0 comments on commit ff91044

Please sign in to comment.