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 import models | |
class Artist(models.Model): | |
first_name = models.CharField(max_length=50) | |
last_name = models.CharField(max_length=50) | |
class Album(models.Model): | |
name = models.CharField(max_length=150) | |
release_date = models.DateField() | |
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 unittest | |
class ActiveTests(TestCase): | |
def test_upper(self): | |
self.assertEqual('foo'.upper(), 'FOO') | |
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
var dateEnforcer = function (startDate, endDate) { | |
$(startDate).on('focus', function () { | |
this.previousDate = moment(this.value).format('MM-DD-YYYY'); | |
}).change(function(){ | |
var newDate = moment(this.value).format('MM-DD-YYYY'); | |
var endDateMoment = moment($(endDate).val()).format('MM-DD-YYYY'); | |
if (this.previousDate != 'Invalid date'){ |
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.core.urlresolvers import reverse | |
from django.test import TestCase, Client | |
from hypothesis import given, strategies as st | |
from .models import User | |
class ViewsTestCase(TestCase): | |
PUBLIC_URLS = ['login', ] |
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 import models | |
from localflavor.us.models import USStateField | |
class State(models.Model): | |
name = USStateField(unique=True) | |
incits_code = models.CharField(max_length=250) | |
class Meta: | |
ordering = ['name', ] |
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
/* Foundation v2.1.4 http://foundation.zurb.com */ | |
/* Artfully masterminded by ZURB */ | |
/* -------------------------------------------------- | |
Table of Contents | |
----------------------------------------------------- | |
:: Shared Styles | |
:: Page Name 1 | |
:: Page Name 2 | |
*/ |
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
@media screen and (max-width: 600px) { | |
table { | |
border: 0; | |
} | |
table thead { | |
display: none; | |
} |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
import click | |
from netmiko import ConnectHandler | |
def normalize(v): |
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 OrganizationSerializer(CreatedWithEpochSerializer): | |
id = serializers.CharField(source='client_generated_id') | |
address = UsAddressSerializer(required=False) | |
role = serializers.CharField(read_only=True, source='Membership__role') | |
class Meta: | |
model = Organization | |
fields = ('id', 'role', 'name', 'url', 'archived', 'created', 'address') |
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 need_approval(self): | |
queryset = self | |
queryset = queryset.annotate( | |
conflict_group=Concat( | |
'employee_id', Value('|'), 'date_applied', | |
output_field=models.CharField() | |
), | |
paycode_count=Count('codes') | |
) | |
conflicts = queryset.values('conflict_group').annotate( |
OlderNewer