This file contains hidden or 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 one_session_per_user.models import User, Visitor | |
from django.contrib.sessions.models import Session | |
class OneSessionPerUserMiddleware(object): | |
"""http://stackoverflow.com/a/1814797""" | |
def process_request(self, request): | |
if isinstance(request.user, User): | |
current_key = request.session.session_key |
This file contains hidden or 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys, os, getopt | |
from django.core.management import setup_environ | |
import settings | |
setup_environ(settings) | |
from django.db.models import Q |
This file contains hidden or 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
import csv | |
from cStringIO import StringIO | |
from scrapy.http import Request | |
from scrapy.spider import BaseSpider | |
from scrapy.selector import HtmlXPathSelector | |
from scrapy_tests.items import CrunchfeedItem | |
class Crunchfeed(BaseSpider): |
This file contains hidden or 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
{% load i18n future static fb_tags mezzanine_tags %} | |
{% load sorl_thumbnail %} | |
{% if query.pop %} | |
<style> | |
{% if query.pop == '4' %} | |
#media-library-popup #header, #media-library-popup .object-tools {display: none;} | |
#media-library-popup h1 {margin: -60px 0 15px 0;} | |
{% else %} | |
h1 {margin:-30px 0 15px 0;} |
This file contains hidden or 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 cStringIO import StringIO | |
@register.simple_tag | |
def thumbnail(image_url, width, height, quality=95): | |
""" | |
Given the URL to an image, resizes the image using the given width and | |
height on the first time it is requested, and returns the URL to the new | |
resized image. if width or height are zero then original ratio is | |
maintained. | |
""" | |
if not image_url: |
This file contains hidden or 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
# add this soewhere where it gets loaded very early, i.e. | |
# your shop's models.py | |
from django.contrib.auth import login | |
from django.contrib.auth.signals import user_logged_in | |
from django.dispatch import receiver | |
from registration.signals import user_activated | |
from shop.models.defaults.cart import Cart | |
This file contains hidden or 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
<?php get_header(); ?> | |
<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?> | |
<?php if (have_posts()) : ?> | |
<?php | |
$order = "&orderby=cost&order=DESC"; | |
$s2 = ' selected="selected"'; | |
if ($_POST['select'] == 'title') { $order = "&orderby=title&order=ASC"; $s1 = ' selected="selected"'; $s2 = ''; } |
This file contains hidden or 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
# This is an auto-generated Django model module. | |
# You'll have to do the following manually to clean this up: | |
# * Rearrange models' order | |
# * Make sure each model has one field with primary_key=True | |
# Feel free to rename the models, but don't rename db_table values or field names. | |
# | |
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]' | |
# into your database. | |
from django.db import models |