Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/rr/admin.py b/planetstack/rr/admin.py
new file mode 100644
index 0000000..1ecb191
--- /dev/null
+++ b/planetstack/rr/admin.py
@@ -0,0 +1,55 @@
+from django.contrib import admin
+
+from hpc.models import *
+from django import forms
+from django.utils.safestring import mark_safe
+from django.contrib.auth.admin import UserAdmin
+from django.contrib.admin.widgets import FilteredSelectMultiple
+from django.contrib.auth.forms import ReadOnlyPasswordHashField
+from django.contrib.auth.signals import user_logged_in
+from django.utils import timezone
+from django.contrib.contenttypes import generic
+from suit.widgets import LinkedSelect
+from core.admin import SingletonAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, PlStackTabularInline
+
+class RRServiceAdmin(SingletonAdmin):
+ model = RRService
+ verbose_name = "RR Service"
+ verbose_name_plural = "RR Service"
+ list_display = ("backend_status_icon", "name","enabled")
+ list_display_links = ('backend_status_icon', 'name', )
+ fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description'], 'classes':['suit-tab suit-tab-general']})]
+ readonly_fields = ('backend_status_text', )
+ inlines = [SliceInline,ServiceAttrAsTabInline]
+
+ user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
+
+ suit_form_tabs =(('general', 'RR Service Details'),
+ ('slices','Slices'),
+ ('serviceattrs','Additional Attributes'),
+ )
+
+class DNSNameInline(PlStackTabularInline):
+ model = CDNPrefix
+ extra = 0
+ suit_classes = 'suit-tab suit-tab-prefixes'
+ fields = ('dns_name_id', 'name', 'enabled')
+ readonly_fields = ('dns_name_id',)
+
+class DNSNameForm(forms.ModelForm):
+ class Meta:
+ widgets = {
+ 'contentProvider' : LinkedSelect
+ }
+
+class DNSNameAdmin(ReadOnlyAwareAdmin):
+ form = CDNPrefixForm
+ list_display = ['name']
+ list_display_links = ('name', )
+ fields = ['name', 'dns_name_id', 'description', 'enabled']
+ readonly_fields = ( )
+ user_readonly_fields = ['name', "dns_name_id", "description", "enabled"]
+
+
+admin.site.register(DNSName, DNSNameAdmin)
+admin.site.register(RRService, RRServiceAdmin)
diff --git a/planetstack/rr/models.py b/planetstack/rr/models.py
new file mode 100644
index 0000000..661c252
--- /dev/null
+++ b/planetstack/rr/models.py
@@ -0,0 +1,30 @@
+from django.db import models
+from core.models import User, Service, SingletonModel, PlCoreBase
+import os
+from django.db import models
+from django.forms.models import model_to_dict
+
+
+# Create your models here.
+
+class RRService(SingletonModel,Service):
+
+ class Meta:
+ app_label = "rr"
+ verbose_name = "RR Service"
+
+class DNSName(PlCoreBase):
+ class Meta:
+ app_label = "rr"
+
+ cdn_prefix_id = models.IntegerField(null=True, blank=True)
+ prefix = models.CharField(max_length=200, help_text="DNS Name")
+ contentProvider = models.ForeignKey(ContentProvider)
+ description = models.TextField(max_length=254,null=True, blank=True,help_text="Description of DNS Name")
+
+ defaultOriginServer = models.ForeignKey(OriginServer, blank=True, null=True)
+ enabled = models.BooleanField(default=True)
+
+ def __unicode__(self): return u'%s' % (self.prefix)
+
+
diff --git a/planetstack/rr/views.py b/planetstack/rr/views.py
new file mode 100644
index 0000000..60f00ef
--- /dev/null
+++ b/planetstack/rr/views.py
@@ -0,0 +1 @@
+# Create your views here.