diff --git a/pandora/urlalias/__init__.py b/pandora/urlalias/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pandora/urlalias/models.py b/pandora/urlalias/models.py new file mode 100644 index 00000000..38772ee6 --- /dev/null +++ b/pandora/urlalias/models.py @@ -0,0 +1,15 @@ +from django.db import models + + +class IDAlias(models.Model): + old = models.CharField(max_length=255, unique=True) + new = models.CharField(max_length=255) + +class LayerAlias(models.Model): + old = models.CharField(max_length=255, unique=True) + new = models.CharField(max_length=255) + +class Alias(models.Model): + url = models.CharField(max_length=255, unique=True) + target = models.CharField(max_length=255) + diff --git a/pandora/urlalias/tests.py b/pandora/urlalias/tests.py new file mode 100644 index 00000000..2247054b --- /dev/null +++ b/pandora/urlalias/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/pandora/urlalias/views.py b/pandora/urlalias/views.py new file mode 100644 index 00000000..a9dcac25 --- /dev/null +++ b/pandora/urlalias/views.py @@ -0,0 +1,12 @@ +# Create your views here. +import models + +def padma_video(request, hid, view=''): + alias = get_object_or_404(models.IDAlias, old=hid) + url = '/%s' % alias.new + if view: + url += '/' + { + }.get(view, view) + #FIXME: reqire layer urls, reqrite timerange urls + raise redirect(url) +