Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #128 from rossbruniges/admin-winners

Closes #120, #121, #122 - allowing winners to be chosen and then displayed
  • Loading branch information...
commit 2079dc529dd7746baf9fc70f73fc105f36b05735 2 parents d3380b1 + 13d538c
@rossbruniges rossbruniges authored
View
89 gameon/base/static/base/css/home.css
@@ -48,6 +48,14 @@ div[role=main] .big-picture .busta {
-moz-animation: float 3s infinite;
animation: float 3s infinite;
}
+.closed div[role=main] .big-picture .busta {
+ padding: 2em 30px 2em 360px;
+ background: url('/static/base/img/home/winning-cup.png') 40px 2em no-repeat;
+ position: relative;
+ -webkit-animation: none;
+ -moz-animation: none;
+ animation: none;
+}
.big-picture .busta > i {
content: "";
width: 305px;
@@ -113,6 +121,61 @@ div[role=main] .big-picture .busta {
.build li.market:before {
background-image: url('/static/base/img/home/panel-market.png');
}
+.winners li {
+ padding: 30px;
+ margin: 0;
+ background: #e6e6e6;
+ border: 1px solid #c4c4c4;
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
+ border-radius: 8px;
+ width: 31%;
+ margin-right: 2%;
+ min-height: 300px;
+}
+.entries li:nth-child(3n+1) {
+ clear: none;
+}
+.winners li:before {
+ content: none;
+}
+.winners li h2 {
+ margin-top: 0.2em;
+}
+.winners .champ {
+ width: 97%;
+ position: relative;
+ margin: 0 0 1em 0;
+ min-height: 20px;
+}
+.winners li b {
+ color: #000;
+}
+.winners li a {
+ position: relative;
+}
+.winners .champ a {
+ position: static;
+}
+.winners .frame {
+ max-height: 120px;
+}
+.champ .frame {
+ width: 300px;
+ max-height: 200px;
+ margin-right: 20px;
+}
+.winners .badge {
+ left: -10px;
+ top: 10px;
+ background: transparent;
+ padding: 0;
+ width: auto;
+}
+.winners .champ .badge {
+ top: 20px;
+ left: 25px;
+}
.gameon_partners .col {
float: left;
width: 50%;
@@ -277,7 +340,8 @@ div[role=main] .big-picture .busta {
}
@media all and (max-width: 800px) {
- div[role=main] .big-picture .busta {
+ div[role=main] .big-picture .busta,
+ .closed div[role=main] .big-picture .busta {
background-image: none;
-webkit-animation: none;
-moz-animation: none;
@@ -327,6 +391,29 @@ div[role=main] .big-picture .busta {
margin-left: 0;
left: 0;
}
+ .winners li {
+ padding: 10px;
+ margin-right: 0;
+ min-height: 30px;
+ }
+ .winners .frame {
+ max-height: 200px;
+ }
+ .winners .champ {
+ width: 100%;
+ }
+ .winners .champ .frame {
+ width: 100%;
+ max-height: 300px;
+ }
+ .winners .badge {
+ left: -5px;
+ top: 10px;
+ }
+ .winners .champ .badge {
+ top: 0;
+ left: 5px;
+ }
.partners li {
padding-left: 0;
height: auto;
View
13 gameon/base/static/base/css/master.css
@@ -332,6 +332,7 @@ nav li a {
box-sizing: border-box;
padding: 0 10px;
margin-bottom: 1em;
+ position: relative;
}
.entries li:nth-child(3n+1) {
clear: left;
@@ -340,6 +341,15 @@ nav li a {
width: 100%;
height: auto;
display: block;
+ position: relative;
+ z-index: 10;
+}
+.entries .badge {
+ width: auto;
+ position: absolute;
+ top: -1em;
+ left: 0;
+ z-index: 20;
}
.entries .cta {
margin-top: 0.5em;
@@ -507,6 +517,9 @@ nav li a {
width: auto;
margin-right: 0;
}
+ .entries .badge {
+ width: 40%;
+ }
.mini-col {
float: none;
width: auto;
View
BIN  gameon/base/static/base/img/badges/best-device.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  gameon/base/static/base/img/badges/best-hack.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  gameon/base/static/base/img/badges/best-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  gameon/base/static/base/img/badges/champ.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  gameon/base/static/base/img/badges/notable.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  gameon/base/static/base/img/home/winning-cup.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
88 gameon/static_site/templates/static_site/closed.html
@@ -0,0 +1,88 @@
+{% extends 'base.html' %}
+
+{% block page_css %}
+<link rel="stylesheet" href="{{ static('base/css/home.css') }}">
+{% endblock %}
+
+{% block page_title %}Homepage{% endblock %}
+{% block page_id %}home{% endblock %}
+{% block section_class %}landing closed{% endblock %}
+
+{% block header_logo %}
+ <h1 class="logo"><a href="{{ url('static_site.home') }}"><img src="{{ static('base/img/logo.png') }}" alt="Game on" width="262" height="72" /></a></h1>
+{% endblock %}
+
+{% block content %}
+<section class="big-picture cf">
+ <div class="busta">
+ <span></span>
+ <p class="announce">Winners Announced!</p>
+ <p class="shout">Discover the winning entries and play the games!</p>
+ </div>
+</section>
+<section class="build cf">
+ <div class="busta">
+ <h2 class="exclaim">Winning entries</h2>
+ <ol class="winners entries cf">
+ <li class="champ">
+ <a href="{{ url('submissions.entry_single', slug=winners.champ.slug) }}">
+ <span class="frame"><img src="{{ winners.champ.get_image_src() }}" alt="" /></span>
+ <b class="whimper">Grand Prize Winner</b>
+ <h2 class="announce">{{ winners.champ.title }}</h2>
+ {{ winners.champ.get_award_badge()|safe }}
+ </a>
+ <p class="whimper">{{ winners.champ.description }}</p>
+ </li>
+ <li>
+ <a class="cf" href="{{ url('submissions.entry_single', slug=winners.best_hack.slug) }}">
+ <span class="frame"><img src="{{ winners.best_hack.get_image_src() }}" alt="" /></span>
+ <b class="whimper">Best Hackable Game</b>
+ <h2 class="announce">{{ winners.best_hack.title }}</h2>
+ {{ winners.best_hack.get_award_badge()|safe }}
+
+ </a>
+ <p class="whimper">{{ winners.best_hack.description|truncate(300) }}</p>
+ </li>
+ <li>
+ <a class="cf" href="{{ url('submissions.entry_single', slug=winners.best_device.slug) }}">
+ <span class="frame"><img src="{{ winners.best_device.get_image_src() }}" alt="" /></span>
+ <b class="whimper">Best Multi-Device Game</b>
+ <h2 class="announce">{{ winners.best_device.title }}</h2>
+ {{ winners.best_device.get_award_badge()|safe }}
+ </a>
+ <p class="whimper">{{ winners.best_device.description|truncate(300) }}</p>
+ </li>
+ <li>
+ <a class="cf" href="{{ url('submissions.entry_single', slug=winners.best_web.slug) }}">
+ <span class="frame"><img src="{{ winners.best_web.get_image_src() }}" alt="" /></span>
+ <b class="whimper">Best Web-Only Game</b>
+ <h2 class="announce">{{ winners.best_web.title }}</h2>
+ {{ winners.best_web.get_award_badge()|safe }}
+ </a>
+ <p class="whimper">{{ winners.best_web.description|truncate(300) }}</p>
+ </li>
+ </ol>
+ <p><a href="{{ url('submissions.entry_list') }}" class="cta">See all entries</a></p>
+ <section class="gameon_partners cf">
+ <div class="col">
+ <h2 class="announce">Game On is generously supported by:</h2>
+ <ul class="partners">
+ <li><a href="http://www.nesta.org.uk/"><img src="{{ static('base/img/partners/nesta.png') }}" alt="Nesta" /></a></li>
+ <li><a href="http://www.nominettrust.org.uk/"><img src="{{ static('base/img/partners/nominettrust.png') }}" alt="Nominet Trust" /></a></li>
+ </ul>
+ </div>
+ <div class="col with">
+ <h2 class="announce">In partnership with:</h2>
+ <ul class="partners with">
+ <li class="lg"><a href="http://globalgamejam.org/"><img src="{{ static('base/img/partners/ggj.png') }}" alt="Global Game Jam" /></a></li>
+ <li class="lg"><a href="http://www.igda.org/"><img src="{{ static('base/img/partners/igda.png') }}" alt="IDGA" /></a></li>
+ <li class="cl"><a href="http://www.chillingo.com/"><img src="{{ static('base/img/partners/Chillingo.png') }}" alt="Chillingo" /></a></li>
+ <li><a href="http://ukie.info/"><img src="{{ static('base/img/partners/ukie.png') }}" alt="UKIE" /></a></li>
+ <li><a href="https://github.com/"><img src="{{ static('base/img/partners/GitHub.png') }}" alt="github" /></a></li>
+ <li><a href="http://www.nvidia.co.uk"><img src="{{ static('base/img/partners/nvidia.png') }}" alt="Nvidia" /></a></li>
+ </ul>
+ </div>
+ </section>
+ </div>
+</section>
+{% endblock %}
View
32 gameon/static_site/views.py
@@ -2,7 +2,7 @@
import commonware
-from gameon.submissions.models import Category
+from gameon.submissions.models import Category, Entry, Challenge
from gameon.events.models import Event
@@ -10,19 +10,29 @@
def home(request, template='static_site/landing.html'):
- """Main example view."""
-
upcoming_events = Event.objects.get_upcoming()
+ current_challenge = Challenge.objects.get_current_challenge()
+
+ if not current_challenge.announce_winners:
+ data = {
+ 'events': upcoming_events.order_by('start_date')[:5],
+ 'num_events': upcoming_events.count(),
+ }
+ else:
+ data = {
+ 'winners': {
+ 'champ': Entry.objects.get(award="champ"),
+ 'best_hack': Entry.objects.get(award="best-hack"),
+ 'best_device': Entry.objects.get(award="best-device"),
+ 'best_web': Entry.objects.get(award="best-web"),
+ }
+ }
+ template = 'static_site/closed.html'
- data = {
- 'events': upcoming_events.order_by('start_date')[:5],
- 'num_events': upcoming_events.count()
- }
return render(request, template, data)
def rules(request, template='static_site/rules.html'):
- """Main example view."""
data = {
'categories': Category.objects.all().order_by('name'),
}
@@ -30,19 +40,16 @@ def rules(request, template='static_site/rules.html'):
def judges(request, template='static_site/judges.html'):
- """Main example view."""
data = {}
return render(request, template, data)
def judging(request, template='static_site/judging.html'):
- """Main example view."""
data = {}
return render(request, template, data)
def prizes(request, template='static_site/prizes.html'):
- """Main example view."""
data = {
'categories': Category.objects.all().order_by('name'),
}
@@ -50,18 +57,15 @@ def prizes(request, template='static_site/prizes.html'):
def resources(request, template='static_site/resources.html'):
- """Main example view."""
data = {}
return render(request, template, data)
def legal(request, template='static_site/legal.html'):
- """Main example view."""
data = {}
return render(request, template, data)
def faqs(request, template='static_site/faqs.html'):
- """Main example view."""
data = {}
return render(request, template, data)
View
5 gameon/submissions/admin.py
@@ -15,8 +15,9 @@ class CategoryAdmin(admin.ModelAdmin):
class EntryAdmin(admin.ModelAdmin):
model = models.Entry
prepopulated_fields = {"slug": ("title",)}
- list_display = ('title', 'category', 'created_by')
- list_filter = ('category',)
+ list_display = ('title', 'category', 'created_by', 'award')
+ list_filter = ('category', 'award')
+ list_editable = ('award', )
admin.site.register(models.Challenge, ChallengeAdmin)
View
101 gameon/submissions/migrations/0011_auto__add_field_entry_award.py
@@ -0,0 +1,101 @@
+# -*- 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 field 'Entry.award'
+ db.add_column('submissions_entry', 'award',
+ self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting field 'Entry.award'
+ db.delete_column('submissions_entry', 'award')
+
+
+ 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'},
+ 'awarded_for': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ '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': '200'}),
+ 'start_date': ('django.db.models.fields.DateTimeField', [], {})
+ },
+ 'submissions.entry': {
+ 'Meta': {'object_name': 'Entry'},
+ 'award': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ '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': "''"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
+ 'team_description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'team_members': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'team_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ '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'}),
+ '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': "''", 'max_length': '255'})
+ },
+ 'users.profile': {
+ 'Meta': {'object_name': 'Profile'},
+ 'bio': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ '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'}),
+ 'website': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '255', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['submissions']
View
102 gameon/submissions/migrations/0012_auto__add_field_challenge_announce_winners.py
@@ -0,0 +1,102 @@
+# -*- 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 field 'Challenge.announce_winners'
+ db.add_column('submissions_challenge', 'announce_winners',
+ self.gf('django.db.models.fields.BooleanField')(default=False),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting field 'Challenge.announce_winners'
+ db.delete_column('submissions_challenge', 'announce_winners')
+
+
+ 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'},
+ 'awarded_for': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ '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'},
+ 'announce_winners': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ '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': '200'}),
+ 'start_date': ('django.db.models.fields.DateTimeField', [], {})
+ },
+ 'submissions.entry': {
+ 'Meta': {'object_name': 'Entry'},
+ 'award': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ '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': "''"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
+ 'team_description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'team_members': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'team_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ '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'}),
+ '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': "''", 'max_length': '255'})
+ },
+ 'users.profile': {
+ 'Meta': {'object_name': 'Profile'},
+ 'bio': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ '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'}),
+ 'website': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '255', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['submissions']
View
25 gameon/submissions/models.py
@@ -34,6 +34,14 @@
}
}
+AWARD_CHOICES = (
+ ('champ', 'Grand Champion'),
+ ('best-hack', 'Best Hackable Game'),
+ ('best-device', 'Best Multi-Device Game'),
+ ('best-web', 'Best Web-Only Game'),
+ ('notable', 'Notable Runner-Up')
+)
+
def url2embed(url):
if not url:
@@ -58,6 +66,8 @@ class Challenge(models.Model):
verbose_name=_(u'Slug'))
start_date = models.DateTimeField(verbose_name=_(u'Start date'))
end_date = models.DateTimeField(verbose_name=_(u'End date'))
+ announce_winners = models.BooleanField(default=False,
+ help_text="Tick when you've selected the winners and want to tell people!")
def __unicode__(self):
return self.name
@@ -116,6 +126,8 @@ class Entry(models.Model):
validators=[MaxLengthValidator(250)], blank=True)
to_market = models.BooleanField(verbose_name="redirect to marketplace",
default=False)
+ award = models.CharField(max_length=255, blank=True, null=True,
+ choices=AWARD_CHOICES)
def __unicode__(self):
return self.title
@@ -147,6 +159,19 @@ def has_entry_feature(self):
"""
return url2embed(self.video_url) or self.thumbnail
+ @property
+ def has_award(self):
+ return self.award or False
+
+ def get_award_badge(self):
+ static_url = getattr(settings, 'STATIC_URL', '')
+ static_path = lambda f: f and '%s%s' % (static_url, f)
+ badge_values = filter(lambda x: x[0] == self.award, AWARD_CHOICES)[0]
+ return '<img class="badge" src="%s" alt="This entry was awarded %s" />' % (
+ static_path('base/img/badges/%s.png' % badge_values[0]),
+ badge_values[1]
+ )
+
def get_entry_feature(self):
"""
If there is a video_url we want to include that as a feature, otherwise
View
1  gameon/submissions/templates/submissions/list.html
@@ -26,6 +26,7 @@ <h1 class="busta shout">All Entries</h1>
<span class="frame"><img src="{{ sub.get_image_src() }}" width="180" height="102" alt="" /></span>
{{ sub.title }}
</a>
+ {% if sub.has_award %}{{ sub.get_award_badge()|safe }}{% endif %}
{% if sub.editable_by(user=request.user) and request.challenge.is_open() %}
<a class="cta whimper" href="{{ url('submissions.entry_edit', slug=sub.slug) }}">Edit your game</a>
{% endif %}
Please sign in to comment.
Something went wrong with that request. Please try again.