Mercurial > agora
changeset 1:013cf0aa49b7
Implement basic mippets, stub templates
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Thu, 24 Jun 2010 08:59:14 -0500 |
parents | 448f907a9d7e |
children | 3cef0d445036 |
files | mippet/__init__.py mippet/admin.py mippet/models.py mippet/tests.py mippet/views.py templates/404.html templates/500.html templates/index.html urls.py |
diffstat | 8 files changed, 94 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mippet/admin.py Thu Jun 24 08:59:14 2010 -0500 @@ -0,0 +1,6 @@ +from agora.mippet.models import * +from django.contrib import admin + +admin.site.register(mscript) +admin.site.register(free_license) +admin.site.register(bundle)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mippet/models.py Thu Jun 24 08:59:14 2010 -0500 @@ -0,0 +1,27 @@ +from django.db import models + +# Create your models here. + +class free_license(models.Model): + name = models.CharField(max_length=200) + desc = models.TextField() + text = models.TextField() + gpl_compatible = models.BooleanField() + def __unicode__(self): + return self.name + + +class mscript(models.Model): + name = models.CharField(max_length=512) + code = models.TextField() + free_license = models.ForeignKey(free_license) + underlying_file = models.FileField(upload_to="var/") + is_standalone = models.BooleanField() + def __unicode__(self): + return self(name) + +class bundle(models.Model): + name = models.CharField(max_length=512) + script = mscript() + def __unicode__(self): + return self(name)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mippet/tests.py Thu Jun 24 08:59:14 2010 -0500 @@ -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 +"""} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mippet/views.py Thu Jun 24 08:59:14 2010 -0500 @@ -0,0 +1,1 @@ +# Create your views here.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/404.html Thu Jun 24 08:59:14 2010 -0500 @@ -0,0 +1,10 @@ +<html> +<head> +<title>Quoth the server...</title> +</head> +<body> +<p> +404! +</p> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/500.html Thu Jun 24 08:59:14 2010 -0500 @@ -0,0 +1,14 @@ +<html> + <head> + <title>Oh, snap!</title> + </head> + <body> + <p> + Uh... looks like we messed up somehow. If this problem persists, + please let us know at agora@octave.org + </p> + <p> + Thanks! + </p> + </body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/index.html Thu Jun 24 08:59:14 2010 -0500 @@ -0,0 +1,10 @@ +<html> +<head> +<title>Agora Octave</title> +</head> +<body> +<p> +Main screen turn on! +</p> +</body> +</html>
--- a/urls.py Wed Jun 16 23:18:41 2010 -0500 +++ b/urls.py Thu Jun 24 08:59:14 2010 -0500 @@ -5,6 +5,8 @@ admin.autodiscover() urlpatterns = patterns('', + + (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'index.html'}), # Example: # (r'^agora/', include('agora.foo.urls')), @@ -14,4 +16,5 @@ # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), + )