Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add unicode, admin & migrations for releases.

  • Loading branch information...
commit 9fbeae1258bc18b42a15e781cdd7cbe3c8b1b83e 1 parent b50d47d
@aaugustin aaugustin authored
View
12 releases/admin.py
@@ -0,0 +1,12 @@
+from __future__ import absolute_import
+
+from django.contrib import admin
+
+from .models import Release
+
+
+class ReleaseAdmin(admin.ModelAdmin):
+ list_display = ('version', 'date')
+ list_editable = ('date',)
+
+admin.site.register(Release, ReleaseAdmin)
View
32 releases/migrations/0001_initial.py
@@ -0,0 +1,32 @@
+# -*- 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 'Release'
+ db.create_table(u'releases_release', (
+ ('version', self.gf('django.db.models.fields.CharField')(max_length=16, primary_key=True)),
+ ('date', self.gf('django.db.models.fields.DateField')(null=True)),
+ ))
+ db.send_create_signal(u'releases', ['Release'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'Release'
+ db.delete_table(u'releases_release')
+
+
+ models = {
+ u'releases.release': {
+ 'Meta': {'object_name': 'Release'},
+ 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}),
+ 'version': ('django.db.models.fields.CharField', [], {'max_length': '16', 'primary_key': 'True'})
+ }
+ }
+
+ complete_apps = ['releases']
View
0  releases/migrations/__init__.py
No changes.
View
4 releases/models.py
@@ -10,6 +10,10 @@
class Release(models.Model):
version = models.CharField(max_length=16, primary_key=True)
+ date = models.DateField(null=True) # nullable until we have a date for every release
+
+ def __unicode__(self):
+ return self.version
@cached_property
def version_tuple(self):

0 comments on commit 9fbeae1

Please sign in to comment.
Something went wrong with that request. Please try again.