public
Last active

  • Download Gist
pub/urls.py
Python
1 2 3 4 5 6
from django.conf.urls.defaults import *
 
urlpatterns = patterns('',
(r'', 'pub.vies.index'),
(r'^/$', 'pub.views.index'),
)
pub/views.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# Create your views here.
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django import forms
import openidgae
 
#class CallForm(forms.Form):
# phnum = forms.PhoneNumberField()
# message = forms.TextField()
 
# this needs to be moved somewhere else, but for now it can live here
def index(request):
lip = openidgae.get_current_person(request, HttpResponse())
# resp = render_to_response('pub/index.html', {'lip': lip, 'form': CallForm()})
resp = render_to_response('pub/index.html', {'lip': lip})
return resp
templates/base.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>{% block title %}My amazing site{% endblock %}</title>
</head>
<body>
<div id="header">
{% if lip %}
Welcome {{ lip.pretty_openid }}
<a href="{% url openidgae.views.LogoutSubmit %}">logout</a>
{% else %}
<form id="login-form" action="{% url openidgae.views.OpenIDStartSubmit %}?continue={{continueUrl}}" method="post">
<input type="text" name="openid_identifier" id="openid_identifier" />
<input type="submit" value="Verify" />
</form>
 
<!-- BEGIN ID SELECTOR -->
<script type="text/javascript" id="__openidselector" src="https://www.idselector.com/selector/46b0e6d0c8ba5c8617f6f5b970865604c9f87da5" charset="utf-8"></script>
<!-- END ID SELECTOR -->
{% endif %}
</div>
{% block content %}{% endblock %}
</body>
</html>
templates/pub/index.html
HTML
1 2 3 4 5 6 7
{% extends "base.html" %}
 
{% block title %}blahblah!{% endblock %}
 
{% block content %}
blahblahblah
{% endblock %}
urls.py
Python
1 2 3 4 5 6
from django.conf.urls.defaults import *
 
urlpatterns = patterns('',
(r'', include('openidgae.urls')),
(r'^pub', include('pub.urls')),
)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.