Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add unicode, admin & migrations for releases.

  • Loading branch information...
commit 9fbeae1258bc18b42a15e781cdd7cbe3c8b1b83e 1 parent b50d47d
Aymeric Augustin authored March 14, 2013
12  releases/admin.py
... ...
@@ -0,0 +1,12 @@
  1
+from __future__ import absolute_import
  2
+
  3
+from django.contrib import admin
  4
+
  5
+from .models import Release
  6
+
  7
+
  8
+class ReleaseAdmin(admin.ModelAdmin):
  9
+    list_display = ('version', 'date')
  10
+    list_editable = ('date',)
  11
+
  12
+admin.site.register(Release, ReleaseAdmin)
32  releases/migrations/0001_initial.py
... ...
@@ -0,0 +1,32 @@
  1
+# -*- coding: utf-8 -*-
  2
+import datetime
  3
+from south.db import db
  4
+from south.v2 import SchemaMigration
  5
+from django.db import models
  6
+
  7
+
  8
+class Migration(SchemaMigration):
  9
+
  10
+    def forwards(self, orm):
  11
+        # Adding model 'Release'
  12
+        db.create_table(u'releases_release', (
  13
+            ('version', self.gf('django.db.models.fields.CharField')(max_length=16, primary_key=True)),
  14
+            ('date', self.gf('django.db.models.fields.DateField')(null=True)),
  15
+        ))
  16
+        db.send_create_signal(u'releases', ['Release'])
  17
+
  18
+
  19
+    def backwards(self, orm):
  20
+        # Deleting model 'Release'
  21
+        db.delete_table(u'releases_release')
  22
+
  23
+
  24
+    models = {
  25
+        u'releases.release': {
  26
+            'Meta': {'object_name': 'Release'},
  27
+            'date': ('django.db.models.fields.DateField', [], {'null': 'True'}),
  28
+            'version': ('django.db.models.fields.CharField', [], {'max_length': '16', 'primary_key': 'True'})
  29
+        }
  30
+    }
  31
+
  32
+    complete_apps = ['releases']
0  releases/migrations/__init__.py
No changes.
4  releases/models.py
@@ -10,6 +10,10 @@
10 10
 
11 11
 class Release(models.Model):
12 12
     version = models.CharField(max_length=16, primary_key=True)
  13
+    date = models.DateField(null=True)          # nullable until we have a date for every release
  14
+
  15
+    def __unicode__(self):
  16
+        return self.version
13 17
 
14 18
     @cached_property
15 19
     def version_tuple(self):

0 notes on commit 9fbeae1

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