Browse Source

Add a Resources module

Baptiste Jonglez 11 years ago
parent
commit
04b1fea7e2

+ 0 - 0
coin/resources/__init__.py


+ 3 - 0
coin/resources/admin.py

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 20 - 0
coin/resources/models.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from django.db import models
+from netfields import CidrAddressField, NetManager
+
+
+class IPPool(models.Model):
+    """Pool of IP addresses (either v4 or v6)."""
+    name = models.CharField(max_length=255, blank=False, null=False,
+                            verbose_name='Name of the IP pool')
+    description = models.TextField(blank=True, null=False,
+                                   verbose_name='Description of the IP pool')
+    inet = CidrAddressField()
+    objects = NetManager()
+
+
+class IPSubnet(models.Model):
+    inet = CidrAddressField()
+    objects = NetManager()
+    ip_pool = models.ForeignKey(IPPool)
+    offer_subscription = models.ForeignKey('offers.OfferSubscription')

+ 3 - 0
coin/resources/tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 3 - 0
coin/resources/views.py

@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.

+ 2 - 1
coin/settings.py

@@ -143,7 +143,8 @@ INSTALLED_APPS = (
     'ldapdb',  # LDAP as database backend
     'autocomplete_light', #Automagic autocomplete foreingkey form component
     'coin.members',
-    'coin.offers'
+    'coin.offers',
+    'coin.resources'
 )
 
 # A sample logging configuration. The only tangible logging