Created
March 12, 2010 06:44
-
-
Save rdegges/330088 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from myapp.models import Server | |
from myapp.models import ServerForm | |
from django.template import RequestContext | |
from django.shortcuts import render_to_response | |
def create_server(request): | |
""" | |
Create a new Server model. | |
""" | |
if request.method == 'POST': | |
form = ServerForm(request.POST) | |
if form.is_valid(): | |
# Create a new Server object. | |
form.save() | |
else: | |
form = ServerForm() | |
variables = RequestContext(request, { | |
'form': form | |
}) | |
return render_to_response('path/to/template/create.html', variables) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment