diff --git a/.gitignore b/.gitignore
index 49a72cc..956f1d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,4 @@ sqlite3.exe
# Irrelevant files
settings_secret.py
db.sqlite3
+compatibility.csv
diff --git a/deploy/reinitdb.py b/deploy/reinitdb.py
new file mode 100644
index 0000000..776ff8d
--- /dev/null
+++ b/deploy/reinitdb.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+import os
+
+os.system("python ../manage.py reinitdb-compat compatibility.csv")
+#os.system("python ../manage.py reinitdb-blog blog.xml")
diff --git a/website.pyproj b/website.pyproj
index 093eab0..62154c3 100644
--- a/website.pyproj
+++ b/website.pyproj
@@ -43,6 +43,9 @@
+
+
+
@@ -76,6 +79,8 @@
+
+
diff --git a/website/blog/templates/blog_index.html b/website/blog/templates/blog_index.html
index 77192c5..a88b3a3 100644
--- a/website/blog/templates/blog_index.html
+++ b/website/blog/templates/blog_index.html
@@ -6,19 +6,19 @@
+ {{ entry.title }}
+
+
Written by
RPCS3 Staff
on
- {{ entry.date|date:"F j, Y" }}
+ {{ entry.date|date:"F j, Y" }}
/
- {% for tag in entry.tags.all %}
+ {% for tag in entry.tags.all %}
{{ tag.tag }}
- {% endfor %}
- /
+ {% endfor %}
+ /
Short link
@@ -31,9 +31,9 @@
+ {% endfor %}
+
{% endblock %}
diff --git a/website/compat/management/__init__.py b/website/compat/management/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/compat/management/commands/__init__.py b/website/compat/management/commands/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/compat/management/commands/reinitdb-compat.py b/website/compat/management/commands/reinitdb-compat.py
new file mode 100644
index 0000000..c9a250b
--- /dev/null
+++ b/website/compat/management/commands/reinitdb-compat.py
@@ -0,0 +1,33 @@
+from django.core.management.base import BaseCommand, CommandError
+
+from datetime import datetime
+from website.compat.models import Game
+
+class Command(BaseCommand):
+ args = ""
+ help = "Deletes the compatibility database and restarts it from the given CSV backup."
+
+ def handle(self, *args, **options):
+ f = open(args[0], 'r')
+
+ for line in f.readlines():
+ # Manually parsing the CSV file, don't try this at home!
+ fields = line[:-1].split(",")
+ for i in xrange(len(fields)):
+ if fields[i].startswith('"') and fields[i].endswith('"'):
+ fields[i] = fields[i][1:-1]
+ if i == 5:
+ try:
+ fields[i] = datetime.strptime(fields[i], "%Y-%m-%d")
+ except:
+ # If there is no specific release date, choose PS3's release date
+ fields[i] = datetime.strptime("2006-06-11", "%Y-%m-%d")
+
+ # Create and save the object
+ game = Game(
+ titleid=fields[0], name=fields[1], publisher=fields[2], developer=fields[3],
+ genre=fields[4], release=fields[5], firmware=fields[6], compatibility=fields[7],
+ )
+ game.save()
+
+ f.close()
diff --git a/website/compat/models.py b/website/compat/models.py
index 1414bd3..0a12f03 100644
--- a/website/compat/models.py
+++ b/website/compat/models.py
@@ -5,7 +5,7 @@ from website.constants import *
class Game(models.Model):
# Static
titleid = models.CharField(max_length=9, primary_key=True)
- name = models.CharField(max_length=64)
+ name = models.CharField(max_length=128)
publisher = models.CharField(max_length=64)
developer = models.CharField(max_length=64)
genre = models.CharField(max_length=32)
diff --git a/website/compat/templates/index.html b/website/compat/templates/index.html
index 5749928..47251c2 100644
--- a/website/compat/templates/index.html
+++ b/website/compat/templates/index.html
@@ -10,45 +10,15 @@
Stats
- - Perfect: {{ strResults.0 }} %
+ {% for result in results %}
+ - {{ result.category }}: {{ result.string }} %
-
-
-
- - Playable: {{ strResults.1 }} %
- -
-
-
-
- - Ingame: {{ strResults.2 }} %
- -
-
-
-
- - Intro: {{ strResults.3 }} %
- -
-
-
-
- - Nothing: {{ strResults.4 }} %
- -
-
diff --git a/website/compat/views.py b/website/compat/views.py
index e9fc5f4..6b1407d 100644
--- a/website/compat/views.py
+++ b/website/compat/views.py
@@ -14,12 +14,19 @@ def compat_index(request):
len(Game.objects.filter(compatibility=C.COMPATIBILITY_PERFECT)),
]
total = sum(stats)
- strResults = map(lambda x: '%.2f' % (100.0*x/total if total else 0), stats)
- intResults = map(lambda x: 100*x/total if total else 0, stats)
+
+ # TODO: Rewrite this with more Django style
+ results = []
+ for i in range(len(stats))[::-1]:
+ results.append({
+ 'category' : C.COMPATIBILITY[i+1][1], # e.g. 'Playable'
+ 'string' : '%.2f' % (100.0 * stats[i] / total if total else 0), # e.g. '12.34'
+ 'int' : 100 * stats[i] / total if total else 0, # e.g. 12
+ 'color' : ['#555555', '#D9534F', '#F0AD4E', '#5CB85C', '#428BCA'][i], # e.g. '#5CB85C'
+ })
objects = {
- 'strResults' : strResults,
- 'intResults' : intResults,
+ 'results' : results,
'chars' : '#ABCDEFGHIJKLMNOPQRSTUVWXYZ',
}
return render(request, 'index.html', objects)