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
<div class="registration_form"> | |
<p> <h4>New Customer (Register for an Account) </h4></p> | |
{% if register_state %} | |
<div class="state"> | |
*{{ register_state }} | |
</div> | |
{% endif %} | |
<form action="" method="post" class="form-horizontal" name="registerform">{% csrf_token %} | |
{{ registerform.non_field_errors }} |
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
/*global module:false*/ | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
/* Handlebars Templates */ | |
handlebars: { | |
whatever: { | |
options: { | |
wrapped: true, |
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
(function() { | |
var jQuery = window.jQuery, | |
frag = document.createDocumentFragment(), | |
js = document.createElement('script'), | |
css = document.createElement('link'), | |
head = document.getElementsByTagName('head'); | |
if (jQuery === undefined || jQuery.fn.jquery !== '1.8.2') { | |
jq = document.createElement('script'); | |
jq.href = "//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"; |
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.db.models import Q | |
from apps.research.models import Product | |
""" | |
`codes` is a list of remaining (str) barcodes from the file. | |
`excludes` is a list of primary keys which i've already found | |
""" | |
minimum_digits = 5 | |
qset = Q() |
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.contrib import admin | |
from example.admin_actions import export_csv_action | |
class ExampleModelAdmin(admin.ModelAdmin): | |
raw_id_fields = ('field1',) | |
list_display = ('field1', 'field2', 'field3',) | |
actions = [ | |
export_csv_action("Export Sepecial Report", |
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 CitedBooksFilter(SimpleListFilter): | |
title = _('cited book') | |
parameter_name = 'book_title' | |
def lookups(self, request, model_admin): | |
return Citation.objects.exclude(cited_book_id=None).values_list('id', 'title').distinct() | |
def queryset(self, request, queryset): | |
if self.value(): | |
queryset = queryset.filter(cited_book_id=self.value()) |
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
(function($) { | |
var $groups, $empty; | |
function init() { | |
var $el = $("#id_number"); | |
$empty = $el.find('option:first'); | |
$groups = $el.find('optgroup'); | |
$('#id_letter').change(update); | |
update(); |
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
import os | |
# All of your normal settings... | |
# Utility function to join paths | |
def get_path(*args): | |
return os.path.realpath(os.path.join(*args)) |
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 import template | |
register = template.Library() | |
@register.simple_tag | |
def date_range(start, end): | |
""" Takes a start date, and end date, then formats them as a range. """ | |
if end - start >= 365: # More than a year |
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.conf import settings | |
from django.core import cache | |
from micawber.providers import bootstrap_embedly as _bootstrap_embedly | |
def bootstrap_embedly(): | |
""" This bootstraps micawber with the embedly bootstrapper, but uses a | |
specific cache. | |
""" |