This file contains 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 django.utils.translation import ugettext_lazy as _ | |
from django.core.urlresolvers import reverse | |
from admin_tools.dashboard import Dashboard, AppIndexDashboard | |
from admin_tools.dashboard import modules | |
# to activate your index dashboard add the following to your settings.py: | |
# | |
# ADMIN_TOOLS_INDEX_DASHBOARD = 'test_proj.dashboard.CustomIndexDashboard' |
This file contains 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
""" | |
The `urlpatterns` list routes URLs to views. For more information please see: | |
https://docs.djangoproject.com/en/1.8/topics/http/urls/ | |
Examples: | |
Function views | |
1. Add an import: from my_app import views | |
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') | |
Class-based views | |
1. Add an import: from other_app.views import Home | |
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') |
This file contains 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
// We bind a new event to our link | |
$('a.tweet').click(function(e){ | |
//We tell our browser not to follow that link | |
e.preventDefault(); | |
//We get the URL of the link | |
var loc = $(this).attr('href'); | |
//We get the title of the link |
This file contains 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
// In you page header, add the open graph meta tags | |
// <meta property="og:title" content="title" /> | |
// <meta property="og:description" content="description" /> | |
// <meta property="og:image" content="thumbnail_image" /> | |
// We bind a new event to our link | |
$('a.facebook').click(function(e){ | |
//We tell our browser not to follow that link | |
e.preventDefault(); |
This file contains 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
// HTML for the share on Tumblr link: | |
// | |
//<a href="http://onefoolishact.com" title="Website title" data-description="The description goes here" class="tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:31px; height:31px; background:url('http://platform.tumblr.com/v1/share_3.png') top left no-repeat transparent;" target="_blank">Share on Tumblr</a> | |
// | |
// and before the </body> add: | |
// | |
// <script type="text/javascript" src="http://platform.tumblr.com/v1/share.js"></script> | |
$('a.tumblr').click(function(e){ | |
This file contains 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
// HTML | |
<div id="mattress_slider"> | |
<div class="mattress_container"> | |
<div class="mattress_slider"> | |
<div class="product-list-item"></div> | |
<div class="product-list-item"></div> | |
<div class="product-list-item"></div> | |
... | |
</div> |
This file contains 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
def wrap(f): | |
def wrapped_f(*args): | |
return f(*args) | |
return wrapped_f | |
# Example | |
# @wrap | |
# def my_function(): | |
# pass | |
# |
This file contains 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
def wrapWithArgs(arg1, arg2, arg3): | |
def wrap(f): | |
def wrapped_f(*args): | |
print arg1, arg2, arg3 | |
return f(*args) | |
return wrapped_f | |
return wrap | |
# Example | |
# @wrap(1,2,3) |
This file contains 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
class CategoryListFilter(SimpleListFilter): | |
# USAGE | |
# In your admin class, pass trhe filter class as tuple for the list_filter attribute: | |
# | |
# list_filter = (CategoryListFilter,) | |
# Human-readable title which will be displayed in the | |
# right admin sidebar just above the filter options. |
This file contains 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
$('.close').click(function(){ | |
$('#video').modal('hide'); | |
}) | |
$('#open-video').click(function(){ | |
$('#video').modal({'show':true}).on('hidden', function () { | |
toggleVideo('hide'); | |
}); | |
toggleVideo(); | |
}) |