Skip to content

Instantly share code, notes, and snippets.

View tuxcanfly's full-sized avatar
🏠
Working from home

Javed Khan tuxcanfly

🏠
Working from home
View GitHub Profile

I've been putting off writing my experience with django form wizard for some time now. I came across this blog post by Kenneth Love which finally compelled me to write this down.

About Django Form Wizard:

Form Wizard can be handy when you have a huge form, and you want to make it less

PLUGGABLE:

Django apps are supposed to be re-usable, but in practice they are not really pluggable. To integrate a app in your project, you typically need to read the docs (or source), figure out the "plug points" like urls, settings, templates, views, templatetags etc.. and then edit your settings, say a prayer or two and hope that it works.

An pluggable app should be more than just a snippet. It should provide a self-contained feature set with hassle-free integration. It should contain all info required to integrate it in a machine readable way so that the process of integrating it can be automated. Some of this info can be auto-generated by parsing the source and saved to a easily readable file, the rest would need to be filled up by the app authors.

EXAMPLE:

@tuxcanfly
tuxcanfly / test.py
Created September 20, 2012 12:51
django bug?
from django.contrib.auth.models import User
User.objects.create(username='admin', email='[email protected]', password='test')
ids = User.objects.none().values_list('id', flat=True)
print ids # prints []
assert User.objects.exclude(id__in=ids) # AssertionError
ids = []
assert User.objects.exclude(id__in=ids) # True
server {
listen 80;
server_name dev.example.com;
access_log off;
error_log off;
# proxy to Apache 2 and mod_python
location / {
proxy_pass http://127.0.0.1:8000/;
@tuxcanfly
tuxcanfly / custom_hash.py
Created July 25, 2012 06:11
Sets and Hash
class User(object):
def __init__(self, username=''):
self.username = username
def __hash__(self):
return hash(self.username)
foo = User('foobar')
bar = User('foobar')
@tuxcanfly
tuxcanfly / selenium_dom.py
Created May 31, 2012 07:33 — forked from pamelafox/selenium_dom.py
Python Selenium Dom Helper Functions
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
@tuxcanfly
tuxcanfly / prime-check.py
Created December 13, 2011 05:47
Polyglot Prime Check
#!/usr/bin/env python
###
#Everything in between these three hashes is executed only in python
# make console.log print stuff
from __future__ import print_function
class console:
log = print
# markup settings
from markupfield.markup import DEFAULT_MARKUP_TYPES
from dinette.libs.postmarkup import render_bbcode
DEFAULT_MARKUP_TYPES.append(('bbcode', render_bbcode))
MARKUP_RENDERERS = DEFAULT_MARKUP_TYPES
DEFAULT_MARKUP_TYPE = "markdown"
/*
*
* Author: Scott Borduin, Lioarlan, LLC
* License: GPL (http://www.gnu.org/licenses/gpl.html) -or- MIT (http://www.opensource.org/licenses/mit-license.php)
*
* Release: 0.15
*
* Acknowledgement: Based partly on public contributions from members of the Sencha.com bulletin board.
*
*/
//
// AwesomeAppAppDelegate.h
// AwesomeApp
//
// Created by admin on 10/05/11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//
#import <UIKit/UIKit.h>