Add bindercommon app. Admin UI configured with model spec for servers,keys,zones

This commit is contained in:
Jeffrey Forman 2011-04-10 22:23:17 -04:00
parent 2269155864
commit 823a175ea8
10 changed files with 81 additions and 0 deletions

View File

View File

@ -0,0 +1,6 @@
from bindercommon.models import BindServer, Key, Zone
from django.contrib import admin
admin.site.register(BindServer)
admin.site.register(Key)
admin.site.register(Zone)

View File

@ -0,0 +1,23 @@
from django.db import models
class BindServer(models.Model):
name = models.CharField(max_length=50)
hostname = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Key(models.Model):
name = models.CharField(max_length=50)
data = models.TextField()
def __unicode__(self):
return self.name
class Zone(models.Model):
server = models.ForeignKey('BindServer')
key = models.ForeignKey('Key')
name = models.CharField(max_length=50)
def __unicode__(self):
return "%s: %s" % (self.server, self.name)

View File

@ -0,0 +1,23 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these 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.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

View File

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

View File

@ -95,4 +95,5 @@ INSTALLED_APPS = (
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'bindercommon',
)

View File

View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,23 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these 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.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

View File

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