From 823a175ea8946d956953f11b7e8e58ff4ba9fac6 Mon Sep 17 00:00:00 2001 From: Jeffrey Forman Date: Sun, 10 Apr 2011 22:23:17 -0400 Subject: [PATCH] Add bindercommon app. Admin UI configured with model spec for servers,keys,zones --- binder/bindercommon/__init__.py | 0 binder/bindercommon/admin.py | 6 ++++++ binder/bindercommon/models.py | 23 +++++++++++++++++++++++ binder/bindercommon/tests.py | 23 +++++++++++++++++++++++ binder/bindercommon/views.py | 1 + binder/settings.py | 1 + binder/zonemanager/__init__.py | 0 binder/zonemanager/models.py | 3 +++ binder/zonemanager/tests.py | 23 +++++++++++++++++++++++ binder/zonemanager/views.py | 1 + 10 files changed, 81 insertions(+) create mode 100644 binder/bindercommon/__init__.py create mode 100644 binder/bindercommon/admin.py create mode 100644 binder/bindercommon/models.py create mode 100644 binder/bindercommon/tests.py create mode 100644 binder/bindercommon/views.py create mode 100644 binder/zonemanager/__init__.py create mode 100644 binder/zonemanager/models.py create mode 100644 binder/zonemanager/tests.py create mode 100644 binder/zonemanager/views.py diff --git a/binder/bindercommon/__init__.py b/binder/bindercommon/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/binder/bindercommon/admin.py b/binder/bindercommon/admin.py new file mode 100644 index 0000000..5dda5c0 --- /dev/null +++ b/binder/bindercommon/admin.py @@ -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) diff --git a/binder/bindercommon/models.py b/binder/bindercommon/models.py new file mode 100644 index 0000000..3227213 --- /dev/null +++ b/binder/bindercommon/models.py @@ -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) diff --git a/binder/bindercommon/tests.py b/binder/bindercommon/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/binder/bindercommon/tests.py @@ -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 +"""} + diff --git a/binder/bindercommon/views.py b/binder/bindercommon/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/binder/bindercommon/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/binder/settings.py b/binder/settings.py index ed35c90..81f2886 100644 --- a/binder/settings.py +++ b/binder/settings.py @@ -95,4 +95,5 @@ INSTALLED_APPS = ( 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', + 'bindercommon', ) diff --git a/binder/zonemanager/__init__.py b/binder/zonemanager/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/binder/zonemanager/models.py b/binder/zonemanager/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/binder/zonemanager/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/binder/zonemanager/tests.py b/binder/zonemanager/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/binder/zonemanager/tests.py @@ -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 +"""} + diff --git a/binder/zonemanager/views.py b/binder/zonemanager/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/binder/zonemanager/views.py @@ -0,0 +1 @@ +# Create your views here.