Skip to content

Instantly share code, notes, and snippets.

@robrocker7
robrocker7 / gist:3230400
Created August 1, 2012 20:25
Affiliate
class Profile(models.Model):
PROFILE_STATUS = (
('DECLINED', 'Declined'),
('APPROVED', 'Approved'),
('PENDING', 'Pending')
)
name = models.CharField(max_length=128)
title = models.CharField(max_length=128, blank=True, null=True)
class SearchEngineReferrerMiddleware(object):
"""
Usage example:
==============
{% if request.session.search_engine %}
You searched for {{ request.session.search_term }} using {{ request.session.search_engine }}.
{% endif %}
"""
SEARCH_PARAMS = {
@robrocker7
robrocker7 / urls.py
Created September 7, 2012 15:43
Example of URLS.py
from django.conf.urls.defaults import *
from django.conf import settings
from django.views.generic.simple import redirect_to
from django.views.decorators.cache import cache_page
from apps.common.views import simple_dtt
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
@robrocker7
robrocker7 / common.py
Created September 7, 2012 15:46
Example of simple_dtt
def simple_dtt(request, template, extra_context):
expire_time = timedelta(days=90)
if 'pages' in extra_context:
pages = extra_context['pages']
pages.append(extra_context['page_name'])
else:
pages = get_active(urls.urlpatterns, extra_context['page_name'])
@robrocker7
robrocker7 / base.html
Created September 7, 2012 15:48
Example of Base.html
{% load content_tags content_filters sekizai_tags %}<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>{% block page_title %}{% endblock %}</title>
<meta name="description" content="{% block page_description %}{% endblock %}" />
<meta name="keywords" content="{% block page_keywords %}{% endblock %}" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<meta name="rating" content="general" />
<meta name="distribution" content="global" />
<meta name="resource-type" content="document" />
@robrocker7
robrocker7 / index.html
Created September 7, 2012 15:50
Example of index.html
{% extends "base.html" %}
{% load content_filters content_tags sekizai_tags testimonial_tags %}
{% block css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/home.css">
<!-- Google Analytics Content Experiment code -->
<script>function utmx_section(){}function utmx(){}(function(){var
k='#######',d=document,l=d.location,c=d.cookie;
if(l.search.indexOf('utm_expid='+k)>0)return;
@robrocker7
robrocker7 / index.html
Created September 7, 2012 15:54
Example of site2/index.html
{% extends "base.html" %}
{% load content_filters content_tags sekizai_tags testimonial_tags %}
{% block page_title %}2nd amazing title tag!{% endblock %}
{% block css %}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/affiliates/sem-landing-page/home.css" />
{% endblock %}
@robrocker7
robrocker7 / views.py
Created September 7, 2012 16:00
example custom view
def index(request):
ctx = {}
ctx['page_name'] = 'index'
ctx['pages'] = ['index']
latest_news = Article.objects.order_by('-date_created')[:3]
ctx['latest_news'] = latest_news
return simple_dtt(request, 'index.html', ctx)
<VirtualHost 000.000.000.000:80>
ServerName brandname.com
ServerAlias www.brandname.com
DocumentRoot /path/to/htdocs
ErrorLog /path/to/logs/error_log
TransferLog /path/to/logs/access_log
Alias /favicon.ico /path/to/favicon.ico
Alias /django-media/ "/path/to/app/media/"
Alias /static/ "/path/to/app/static/"
import httplib, urllib
from django.utils import simplejson
"""
curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: Your_API_username"
-H "X-PAYPAL-SECURITY-PASSWORD: Your_API_password"
-H "X-PAYPAL-SECURITY-SIGNATURE: Your_API_signature"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"