SF.net SVN: morphix: [2587] trunk/morphixlivekiosk/scripts/mbuild
[email protected] Wed, 07 Nov 2007 15:19:26 -0800
| Newsgroups | gmane.linux.morphix.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2587
http://morphix.svn.sourceforge.net/morphix/?rev=2587&view=rev
Author: bmsleight
Date: 2007-11-07 15:19:24 -0800 (Wed, 07 Nov 2007)
Log Message:
-----------
I am starting to like django
Modified Paths:
--------------
trunk/morphixlivekiosk/scripts/mbuild/urls.py
trunk/morphixlivekiosk/scripts/mbuild/web/models.py
trunk/morphixlivekiosk/scripts/mbuild/web/views.py
Added Paths:
-----------
trunk/morphixlivekiosk/scripts/mbuild/templates/emailnotify.html
trunk/morphixlivekiosk/scripts/mbuild/templates/template.html
Added: trunk/morphixlivekiosk/scripts/mbuild/templates/emailnotify.html
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/templates/emailnotify.html (rev 0)
+++ trunk/morphixlivekiosk/scripts/mbuild/templates/emailnotify.html 2007-11-07 23:19:24 UTC (rev 2587)
@@ -0,0 +1,3 @@
+<h1>Custom Built Kiosk LiveCD</h1>
+
+<p>Will email {{ emailnotify }} when the elves have built the kiosk.<p>
\ No newline at end of file
Added: trunk/morphixlivekiosk/scripts/mbuild/templates/template.html
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/templates/template.html (rev 0)
+++ trunk/morphixlivekiosk/scripts/mbuild/templates/template.html 2007-11-07 23:19:24 UTC (rev 2587)
@@ -0,0 +1,9 @@
+<h1>Custom Built Kiosk LiveCD</h1>
+<p>Template {{ template }} is added to the queue to be built<p>
+
+<p>We can email you when the Kiosk has been built.<p>
+<form enctype="multipart/form-data" method="post" action=".">
+ {{ form.as_p }}
+
+ <p><input type="submit" value="Notify →"></p>
+</form>
Modified: trunk/morphixlivekiosk/scripts/mbuild/urls.py
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/urls.py 2007-11-04 15:42:24 UTC (rev 2586)
+++ trunk/morphixlivekiosk/scripts/mbuild/urls.py 2007-11-07 23:19:24 UTC (rev 2587)
@@ -2,6 +2,7 @@
urlpatterns = patterns('',
(r'^$', 'mbuild.web.views.index'),
+ (r'^template/(?P<template>[^/]+)/', 'mbuild.web.views.template'),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
Modified: trunk/morphixlivekiosk/scripts/mbuild/web/models.py
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/web/models.py 2007-11-04 15:42:24 UTC (rev 2586)
+++ trunk/morphixlivekiosk/scripts/mbuild/web/models.py 2007-11-07 23:19:24 UTC (rev 2587)
@@ -1,3 +1,10 @@
from django.db import models
# Create your models here.
+
+class Queue(models.Model):
+ template = models.CharField(maxlength="20", primary_key=True)
+ brand = models.CharField(maxlength="20")
+ built = models.BooleanField(default=False,
+ help_text="Has Kiosk been built")
+ notifybyemail = models.EmailField(null=True)
Modified: trunk/morphixlivekiosk/scripts/mbuild/web/views.py
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/web/views.py 2007-11-04 15:42:24 UTC (rev 2586)
+++ trunk/morphixlivekiosk/scripts/mbuild/web/views.py 2007-11-07 23:19:24 UTC (rev 2587)
@@ -2,6 +2,8 @@
from django.template import RequestContext
from django import newforms as forms
from django.http import HttpResponse
+from django.http import HttpResponseRedirect
+from mbuild.web.models import Queue
import datetime, time
import elementtree.ElementTree as ET
@@ -9,9 +11,9 @@
def index(request):
class BuildForm(forms.Form):
- brand_name = forms.CharField(max_length=150, required=True, label="What Brand would you like to use?")
+ brand_name = forms.CharField(max_length=150, required=True, label="What Brand name would you like to use?")
graphics = forms.ImageField(required=False, label="Graphics file (1024x768, 32pps, any format works best)")
- homepage = forms.CharField(max_length=150, required=True, label="Desired homepage")
+ homepage = forms.CharField(max_length=150, required=True, label="Desired homepage http://")
nav_bar = forms.BooleanField(widget=forms.RadioSelect(choices=[(True, 'Yes'), (False, 'No')]),
initial=True, label="Should the Navigation Bar be visable?")
dhcp = forms.BooleanField(widget=forms.RadioSelect(choices=[(True, 'Yes'), (False, 'No')]),
@@ -42,10 +44,23 @@
tree = ET.ElementTree(root)
tree.write("incoming/%s.xml" % uniq)
- return HttpResponse("The Elves have started preparing your LiveCD.")
+ return HttpResponseRedirect("/template/%s.xml/" % uniq )
else:
form = BuildForm()
context = {'form': form}
return render_to_response('index.html', context,
- context_instance=RequestContext(request))
\ No newline at end of file
+ context_instance=RequestContext(request))
+
+def template(request, template):
+ class BuildForm(forms.Form):
+ emailnotify = forms.EmailField("Email to recieve notifications?")
+ if request.POST:
+ emailnotify = request.POST["emailnotify"]
+ return render_to_response("emailnotify.html",{"emailnotify":emailnotify})
+ else:
+ form = BuildForm()
+ context = {'form': form}
+ return render_to_response('index.html', context,
+ context_instance=RequestContext(request))
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/