Skip to content

Instantly share code, notes, and snippets.

def update(self, **kwargs):
"""
Updates all elements in the current QuerySet, setting all the given
fields to the appropriate values.
"""
assert self.query.can_filter(), \
"Cannot update a query once a slice has been taken."
meta = self.model._meta
self._for_write = True
query = self.query.clone(sql.UpdateQuery)
@bendavis78
bendavis78 / examples.py
Created June 11, 2014 20:43
use cases for #14030
"""
EXAMPLE 1: Get a report of online sales by month
------------------------------------------------ """
from django.db.models import Sum, DatePart, MONTH, YEAR
from store.models import Order
def get_monthly_sales():
# new class DatePart, subclass of ExpressionNode
# Add annotations for year and month, as well as an annotation
#!/bin/sh
#--| OpenVPN |----------------------------------------------------
USERNAME="$(nvram get vyprvpn_username)"
PASSWORD="$(nvram get vyprvpn_password)"
HOST="$(nvram get vyprvpn_host)"
PROTOCOL="udp"
#### Do not make modifications below this line ####
@bendavis78
bendavis78 / -
Created August 22, 2014 20:42
gvim-pythonsix/PKGBUILD
# Maintainer: Thomas Dziedzic <gostrc@gmail.com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
# Contributor: tobias [ tobias at archlinux org ]
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
pkgbase=vim
pkgname=('gvim-pythonsix')
_topver=7.4
_patchlevel=410
__hgrev=4aa63564dd3f
@bendavis78
bendavis78 / designer.html
Last active August 29, 2015 14:08
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<polymer-element name="my-element">
<template>
<style>
#core_header_panel {
@bendavis78
bendavis78 / designer.html
Created November 2, 2014 19:18
designer
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>VanillaJS • TodoMVC</title>
<link rel="stylesheet" href="style/base.css">
<!--[if IE]>
<script src="style/ie.js"></script>
<![endif]-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>VanillaJS • TodoMVC</title>
<link rel="stylesheet" href="style/base.css">
<!--[if IE]>
<script src="style/ie.js"></script>
<![endif]-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>VanillaJS • TodoMVC</title>
<link rel="stylesheet" href="style/base.css">
<!--[if IE]>
<script src="style/ie.js"></script>
<![endif]-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>VanillaJS • TodoMVC</title>
<link rel="stylesheet" href="style/base.css">
<!--[if IE]>
<script src="style/ie.js"></script>
<![endif]-->