Added app database.

Added model mod
This commit is contained in:
Felipe Martín 2013-05-20 16:16:29 +02:00
parent c8d288fc13
commit 50c9ae667d
8 changed files with 82 additions and 0 deletions

View File

View File

@ -0,0 +1,34 @@
# -*- 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 'Mod'
db.create_table(u'database_mod', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
('url', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)),
))
db.send_create_signal('database', ['Mod'])
def backwards(self, orm):
# Deleting model 'Mod'
db.delete_table(u'database_mod')
models = {
'database.mod': {
'Meta': {'ordering': "['name']", 'object_name': 'Mod'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
}
}
complete_apps = ['database']

View File

@ -0,0 +1 @@
from minecraftcodex.databae.models import *

View File

@ -0,0 +1,2 @@
from database.models import mod
#from database.models import version

View File

@ -0,0 +1,28 @@
from django.db import models
from django.contrib import admin
class Mod(models.Model):
name = models.CharField(max_length=256)
url = models.URLField(blank=True)
def __unicode__(self):
return "%s" % self.name
class Meta:
app_label = 'database'
ordering = ['name']
class ModAdmin(admin.ModelAdmin):
list_display = ('name', 'last_version', 'url', )
list_display_links = ('name', )
list_filter = ('name', )
search_fields = ['name', 'url', ]
ordering = ('name', )
def last_version(self, obj):
return '0.0.0'
admin.site.register(Mod, ModAdmin)

View File

@ -0,0 +1,16 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)

View File

@ -0,0 +1 @@
# Create your views here.