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 requests | |
import lxml | |
from lxml import etree | |
from decimal import * | |
from jinja2 import Template | |
import codecs | |
r = requests.get('http://www.azsos.gov/ftp/dbelec/detail.xml') | |
xml_source = r.text | |
root = etree.fromstring(xml_source) |
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 WordpressRouter(object): | |
""" Database router - for the moment, everything to default except the wordpress app, which has its own setting """ | |
def db_for_read(self, model, **hints): | |
if model._meta.app_label == 'wordpress': | |
return 'wordpress' | |
return None | |
def db_for_write(self, model, **hints): | |
if model._meta.app_label == 'wordpress': |
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 sniffer.api import * # import the really small API | |
import os, termstyle, subprocess | |
# you can customize the pass/fail colors like this | |
pass_fg_color = termstyle.green | |
pass_bg_color = termstyle.bg_default | |
fail_fg_color = termstyle.red | |
fail_bg_color = termstyle.bg_default | |
# All lists in this variable will be under surveillance for changes. |
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.test import Client | |
from spec import Spec | |
from nose.tools import * | |
from spec.plugin import SkipTest | |
from wall.models import Wall, Card, Row, Column | |
from wall.factories import WallFactory, CardFactory, RowFactory, ColumnFactory | |
import json | |
class CardWallApplication(Spec): | |
def setup(self): |
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 datetime | |
import factory.django | |
import pytest | |
from freezegun import freeze_time | |
from django.contrib.auth.models import User | |
from forum.models import Topic | |
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
asgiref==3.5.0 | |
attrs==21.4.0 | |
Django==4.0.3 | |
django-debug-toolbar==3.2.4 | |
django-extensions==3.1.5 | |
factory-boy==3.2.1 | |
Faker==13.3.2 | |
iniconfig==1.1.1 | |
packaging==21.3 | |
pluggy==1.0.0 |
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.auth.models import User | |
from django.db import models | |
class Topic(models.Model): | |
title = models.CharField(max_length=30) | |
created_by = models.ForeignKey(User, on_delete=models.CASCADE) | |
created_at = models.DateTimeField(auto_now_add=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
from django.contrib import admin | |
# Register your models here. | |
from forum.models import Topic | |
admin.site.register(Topic) |
OlderNewer