Browse files

urls, and views for simple demo app. Fixed typo in settings. Should b…

…e a complete working demo.
  • Loading branch information...
1 parent 74f640f commit 0bba146726cd0d62586d57229fbe7c5316122b37 @chrisjones-brack3t chrisjones-brack3t committed Aug 29, 2011
View
4 mailchimp_demo/common/templates/common/index.html
@@ -0,0 +1,4 @@
+{% load banana_tags %}
+
+<h1>My Awesome Website</h1>
+<p>{% banana_auth_url 'Authorize' %}</p>
View
15 mailchimp_demo/common/templates/common/profile.html
@@ -0,0 +1,15 @@
+<h1>My Awesome Website</h1>
+
+<h1>Yay, it worked! oauth token details:</h1>
+
+<ul>
+{% for key, value in request.session.mailchimp_details.items %}
+ <li>[{{ key }}] => {{ value }}</li>
+{% endfor %}
+</ul>
+
+<p>Putting all of that data together, you can now use that to either:</p>
+<ol>
+ <li>Configure the endpoint in your application to {{ request.session.mailchimp_details.api_endpoint }}</li>
+ <li>Create a standard formatted API Key using the OAuth2 access token ({{ request.session.mailchimp_details.access_token }}) and the data center ({{ request.session.mailchimp_details.dc }}): <strong>{{ request.session.mailchimp_details.access_token }}-{{ request.session.mailchimp_details.dc }}</strong> which can be passed into most API wrappers.</li>
+</ol>
View
15 mailchimp_demo/common/views.py
@@ -0,0 +1,15 @@
+from django.views.generic.base import TemplateView
+
+
+class IndexView(TemplateView):
+ template_name = 'common/index.html'
+
+ def get(self, request):
+ return self.render_to_response({})
+
+
+class ProfileView(TemplateView):
+ template_name = 'common/profile.html'
+
+ def get(self, request):
+ return self.render_to_response({})
View
2 mailchimp_demo/settings.py
@@ -109,7 +109,7 @@
)
TEMPLATE_CONTEXT_PROCESSORS = (
- "django.contrib.auth.context_processors.auth"
+ "django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
View
5 mailchimp_demo/urls.py
@@ -1,10 +1,15 @@
from django.conf.urls.defaults import patterns, include, url
+from common.views import IndexView, ProfileView
+
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
+ url(r'^$', IndexView.as_view(), name='index'),
+ url(r'^profile/$', ProfileView.as_view(), name='profile'),
+ url(r'', include('banana_py.urls')),
# Examples:
# url(r'^$', 'mailchimp_demo.views.home', name='home'),
# url(r'^mailchimp_demo/', include('mailchimp_demo.foo.urls')),

0 comments on commit 0bba146

Please sign in to comment.