diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index e36bcf4b9676575ae659887df5ac4c337cc784a2..15d50d3ee4c6423f72c783337fd49eb31069f8fd 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -35,9 +35,10 @@ from xmodule.modulestore.exceptions import ItemNotFoundError from models import Registration, UserProfile, PendingNameChange, PendingEmailChange, CourseEnrollment from datetime import date +from collections import namedtuple log = logging.getLogger("mitx.student") - +Article = namedtuple('Article', 'title url author image deck publication publish_date') def csrf_token(context): ''' A csrf token that can be included in a form. @@ -84,6 +85,19 @@ def course_from_id(id): course_loc = CourseDescriptor.id_to_location(id) return modulestore().get_item(course_loc) +def press(request): + json_articles = cache.get("student_press_json_articles") + if json_articles == None: + if hasattr(settings, 'RSS_URL'): + content = urllib.urlopen(settings.PRESS_URL).read() + json_articles = json.loads(content) + else: + content = open(settings.PROJECT_ROOT / "templates" / "press.json").read() + json_articles = json.loads(content) + cache.set("student_press_json_articles", json_articles) + articles = [Article(**article) for article in json_articles] + return render_to_response('static_templates/press.html', {'articles': articles}) + @login_required @ensure_csrf_cookie def dashboard(request): diff --git a/lms/envs/common.py b/lms/envs/common.py index 3b005c5dbe7e97f327241d19c31ec01f970a7f1c..8475cfa9a946cd5d56680e8658e93c114ea20bb6 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -105,6 +105,7 @@ LIB_URL = '/static/js/' # BOOK_URL = '/static/book/' BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/' # For AWS deploys # RSS_URL = r'lms/templates/feed.rss' +# PRESS_URL = r'' RSS_TIMEOUT = 600 # Configuration option for when we want to grab server error pages diff --git a/lms/templates/press.json b/lms/templates/press.json new file mode 100644 index 0000000000000000000000000000000000000000..2dc971489ba0cd5866dcd49a4f39f23cdc230c77 --- /dev/null +++ b/lms/templates/press.json @@ -0,0 +1,146 @@ +[ + { + "title": "Review: MITx's Online Circuit Design and Analysis Course", + "url": "http://spectrum.ieee.org/at-work/education/review-mitxs-online-circuit-design-and-analysis-course", + "author": "Steven J. Frank", + "image": "ieee_logo_178x138.jpeg", + "deck": "This latest experiment in remote learning is not for a casual audience.", + "publication": "IEEE Spectrum", + "publish_date": "July 2012" + }, + { + "title": "More universities sign on to free online course initiative", + "url": "http://www.universityworldnews.com/article.php?story=20120719082235228", + "author": "Alison Moodie", + "image": "univworldnews_logo_178x138.jpeg", + "deck": null, + "publication": "University World News", + "publish_date": "July 19, 2012 Issue No:231" + }, + { + "title": "One Course, 150,000 Students", + "url": "http://nyti.ms/LtlQ5k", + "author": "Tamar Lewin", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "July 18, 2012" + }, + { + "title": "Lessons learned from MITx's prototype course", + "url": "http://mitne.ws/Mdabcp", + "author": "Larry Hardesty, MIT News Office", + "image": "mit_logo_178x138.jpeg", + "deck": "As the team behind MIT's ambitious online learning program gears up to introduce new courses in the fall, it takes stock of its initial experiences.", + "publication": "MIT News", + "publish_date": "7/16/2012" + }, + { + "title": "Software \"coding\": not just for programmers anymore", + "url": "http://gigaom.com/cloud/everybody-codes/", + "author": "Barb Darrow", + "image": "gigaom_logo_178x138.jpeg", + "deck": null, + "publication": "GigaOM", + "publish_date": "July 16, 2012" + }, + { + "title": "Anant Agarwal believes an online education from MIT and Harvard should be available to all", + "url": "http://b.globe.com/P6XKlB", + "author": "Jon Marcus", + "image": "bostonglobe_logo_178x138.jpeg", + "deck": null, + "publication": "The Boston Globe", + "publish_date": "July 15, 2012" + }, + { + "title": "Online Classes Cut Costs, But Do They Dilute Brands?", + "url": "http://n.pr/Lt5ydM", + "author": "Tovia Smith", + "image": "npr_logo_178x138.jpeg", + "deck": null, + "publication": "NPR", + "publish_date": "July 02, 2012" + }, + { + "title": "Coming Your Way: Free Virtual Courses From Top U.S. Universities", + "url": "http://www.openequalfree.org/coming-your-way-free-virtual-courses-from-top-u-s-universities/13993", + "author": null, + "image": "oef_logo_178x138.jpeg", + "deck": null, + "publication": "Open Equal Free", + "publish_date": "June 29, 2012" + }, + { + "title": "Open Online Courses Are No Substitute for Classroom Learning", + "url": "http://bit.ly/MMEdEX", + "author": "Joshua Kim", + "image": "usnews_logo_178x138.jpeg", + "deck": null, + "publication": "US News", + "publish_date": "June 29, 2012" + }, + { + "title": "Harvard and MIT create edX to offer free video online courses to the world", + "url": "http://huff.to/LBucd3", + "author": "Lucy Sheriff", + "image": "huffpost_logo_178x138.jpeg", + "deck": null, + "publication": "The Huffington Post", + "publish_date": "June 20, 2012" + }, + { + "title": "Top universities put their reputations online", + "url": "http://bbc.in/M5avea", + "author": "Irina Khokhlova", + "image": "bbc_logo_178x138.jpeg", + "deck": null, + "publication": "BBC News", + "publish_date": "June 20, 2012" + }, + { + "title": "MIT receives $1 million to support edX partnership", + "url": "http://mitne.ws/Md5Aaa", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Institute receives award as part of Gates Foundation efforts to boost postsecondary graduation rates.", + "publication": "MIT News", + "publish_date": "June 19, 2012" + }, + { + "title": "Column: Ivy League education? Online is the new option", + "url": "http://usat.ly/J73NW7", + "author": "Katrina Trinko", + "image": "usa_logo_178x138.jpeg", + "deck": null, + "publication": "USA Today", + "publish_date": "May 15, 2012" + }, + { + "title": "What is edX?", + "url": "http://mitne.ws/PgYhya", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Answering common questions about MIT and Harvard's new partnership in online education.", + "publication": "MIT News", + "publish_date": "May 02, 2012" + }, + { + "title": "MIT and Harvard announce edX", + "url": "http://mitne.ws/Md5yit", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Joint partnership builds on MITx and Harvard distance learning; aims to benefit campus-based education and beyond.", + "publication": "MIT News", + "publish_date": "May 02, 2012" + }, + { + "title": "MIT and Harvard launch a 'revolution in education'", + "url": "http://mitne.ws/PgZQvY", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Online edX courses will open both universities' classrooms to the world while enhancing on-campus learning.", + "publication": "MIT News", + "publish_date": "May 02, 2012" + } +] diff --git a/lms/templates/static_templates/press.html b/lms/templates/static_templates/press.html index 33b9fe045f6f77c738a0f5f7fdc07a4c022a7f73..6294b346a91bbc3bf982ae3e3bc91f45a0fb18ee 100644 --- a/lms/templates/static_templates/press.html +++ b/lms/templates/static_templates/press.html @@ -5,129 +5,6 @@ <%block name="title"><title>edX in the Press</title></%block> -<%! -from collections import namedtuple - -Article = namedtuple('Article', - 'title url author image deck publication publish_date') - -articles = [ - Article(title="Review: MITx's Online Circuit Design and Analysis Course", - url="http://spectrum.ieee.org/at-work/education/review-mitxs-online-circuit-design-and-analysis-course", - author="Steven J. Frank", - image="ieee_logo_178x138.jpeg", - deck="This latest experiment in remote learning is not for a casual audience.", - publication="IEEE Spectrum", - publish_date="July 2012"), - Article(title="More universities sign on to free online course initiative", - url="http://www.universityworldnews.com/article.php?story=20120719082235228", - author="Alison Moodie", - image="univworldnews_logo_178x138.jpeg", - deck=None, - publication="University World News", - publish_date="July 19, 2012 Issue No:231"), - Article(title="One Course, 150,000 Students", - url="http://nyti.ms/LtlQ5k", - author="Tamar Lewin", - image="nyt_logo_178x138.jpeg", - deck=None, - publication="The New York Times", - publish_date="July 18, 2012"), - Article(title="Lessons learned from MITx's prototype course", - url="http://mitne.ws/Mdabcp", - author="Larry Hardesty, MIT News Office", - image="mit_logo_178x138.jpeg", - deck="As the team behind MIT's ambitious online learning program gears up to introduce new courses in the fall, it takes stock of its initial experiences.", - publication="MIT News", - publish_date="7/16/2012"), - Article(title="Software coding: not just for programmers anymore", - url="http://gigaom.com/cloud/everybody-codes/", - author="Barb Darrow", - image="gigaom_logo_178x138.jpeg", - deck=None, - publication="GigaOM", - publish_date="July 16, 2012"), - Article(title="Anant Agarwal believes an online education from MIT and Harvard should be available to all", - url="http://b.globe.com/P6XKlB", - author="Jon Marcus", - image="bostonglobe_logo_178x138.jpeg", - deck=None, - publication="The Boston Globe", - publish_date="July 15, 2012"), - Article(title="Online Classes Cut Costs, But Do They Dilute Brands?", - url="http://n.pr/Lt5ydM", - author="Tovia Smith", - image="npr_logo_178x138.jpeg", - deck=None, - publication="NPR", - publish_date="July 02, 2012"), - Article(title="Coming Your Way: Free Virtual Courses From Top U.S. Universities", - url="http://www.openequalfree.org/coming-your-way-free-virtual-courses-from-top-u-s-universities/13993", - author=None, - image="oef_logo_178x138.jpeg", - deck=None, - publication="Open Equal Free", - publish_date="June 29, 2012"), - Article(title="Open Online Courses Are No Substitute for Classroom Learning", - url="http://bit.ly/MMEdEX", - author="Joshua Kim", - image="usnews_logo_178x138.jpeg", - deck=None, - publication="US News", - publish_date="June 29, 2012"), - Article(title="Harvard and MIT create edX to offer free video online courses to the world", - url="http://huff.to/LBucd3", - author="Lucy Sheriff", - image="huffpost_logo_178x138.jpeg", - deck=None, - publication="The Huffington Post", - publish_date="June 20, 2012"), - Article(title="Top universities put their reputations online", - url="http://bbc.in/M5avea", - author="Irina Khokhlova", - image="bbc_logo_178x138.jpeg", - deck=None, - publication="BBC News", - publish_date="June 20, 2012"), - Article(title="MIT receives $1 million to support edX partnership", - url="http://mitne.ws/Md5Aaa", - author=None, - image="mit_logo_178x138.jpeg", - deck="Institute receives award as part of Gates Foundation efforts to boost postsecondary graduation rates.", - publication="MIT News", - publish_date="June 19, 2012"), - Article(title="Column: Ivy League education? Online is the new option", - url="http://usat.ly/J73NW7", - author="Katrina Trinko", - image="usa_logo_178x138.jpeg", - deck=None, - publication="USA Today", - publish_date="May 15, 2012"), - Article(title="What is edX?", - url="http://mitne.ws/PgYhya", - author=None, - image="mit_logo_178x138.jpeg", - deck="Answering common questions about MIT and Harvard's new partnership in online education.", - publication="MIT News", - publish_date="May 02, 2012"), - Article(title="MIT and Harvard announce edX", - url="http://mitne.ws/Md5yit", - author=None, - image="mit_logo_178x138.jpeg", - deck="Joint partnership builds on MITx and Harvard distance learning; aims to benefit campus-based education and beyond.", - publication="MIT News", - publish_date="May 02, 2012"), - Article(title="MIT and Harvard launch a 'revolution in education'", - url="http://mitne.ws/PgZQvY", - author=None, - image="mit_logo_178x138.jpeg", - deck="Online edX courses will open both universities' classrooms to the world while enhancing on-campus learning.", - publication="MIT News", - publish_date="May 02, 2012"), -] - -%> - <section class="container about"> <nav> <a href="${reverse('about_edx')}">Vision</a> diff --git a/lms/urls.py b/lms/urls.py index 0785cd96d00c52131c3ff492fc68f3de2bd00b8d..c62267238e8860cbab5d753f0d69f960d46a6da5 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -58,8 +58,7 @@ urlpatterns = ('', {'template': 'jobs.html'}, name="jobs"), url(r'^contact$', 'static_template_view.views.render', {'template': 'contact.html'}, name="contact"), - url(r'^press$', 'static_template_view.views.render', - {'template': 'press.html'}, name="press"), + url(r'^press$', 'student.views.press', name="press"), url(r'^faq$', 'static_template_view.views.render', {'template': 'faq.html'}, name="faq_edx"), url(r'^help$', 'static_template_view.views.render',