Skip to content

Instantly share code, notes, and snippets.

// bootstrapify the default django-allauth forms
$('form p').replaceWith(function() { return '<div>' + this.innerHTML + '</div>'; });
$('form input').each(function(index){
$input = $(this)
var t = $input.attr('type')
if (t == 'text' || t == 'email' || t == 'password' || typeof t == 'undefined' ) {
$input.addClass('form-control')
$input.closest('div').addClass('form-group')
}
if (t == 'radio' || t == 'checkbox' ) {
@Brachamul
Brachamul / command
Created December 26, 2016 11:40
Set an existing user to superuser using Django shell
python manage.py shell
@Brachamul
Brachamul / import.html
Last active November 9, 2015 10:20
SharePointLearningPlatform
<script src="https://gist.githubusercontent.com/Brachamul/e3a12e19ef00ba47c8ff/raw/ae9dc74e8b203b036f2a7a21f9aeb6a4a882860f/script.js"></script>
@Brachamul
Brachamul / Django Ajax template rendering
Created June 13, 2015 15:25
Use a different template wrapper if rendered via AJAX
{% extends request.is_ajax|yesno:"app/base_ajax.html,app/base.html" %}
class Feature(models.Model):
# A feature is what occupies a slot, it can be a man-made constuct or natural terrain.
name = models.CharField(max_length=255)
@Brachamul
Brachamul / admin.py
Last active August 29, 2015 14:05
Django test-app snippet
from django.contrib import admin
# Register your models here.
from .models import Item, Feature, RequiredMaterial, DevelopmentProject
class ItemAdmin(admin.ModelAdmin):
model = Item