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 simple_history.models import HistoricalRecords | |
from django.utils.translation import ugettext_lazy as _ | |
class GetOrNoneManager(models.Manager): | |
""" | |
Adds get_or_none method to objects | |
""" | |
def get_object_or_none(self, default_value=None, *args, **kwargs): |
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
# 1) Create a middlewares/middlewares.py file and copy this: | |
import threading | |
class RequestMiddleware: | |
def __init__(self, get_response, thread_local=threading.local()): | |
self.get_response = get_response | |
self.thread_local = thread_local | |
# One-time configuration and initialization. |
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
APP_NAME='Hotel El Pueblo' | |
APP_ENV=local | |
APP_KEY=base64:y2eRdQynPR8l6vJUlNsO+1IiMUTB45ZdVjiFDi8v2SU= | |
APP_DEBUG=true | |
APP_LOG_LEVEL=debug | |
APP_URL=http://localhost | |
DB_CONNECTION=mysql | |
DB_HOST=127.0.0.1 | |
DB_PORT=3306 |
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 logging | |
from django.utils import translation | |
class SubdomainLanguageMiddleware(object): | |
""" | |
Set the language for the site based on the subdomain the request | |
is being served on. For example, serving on 'fr.domain.com' would | |
make the language French (fr). |
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 fs = require('fs'), | |
path = require('path'), | |
child_process = require('child_process'); | |
function watchStyles(sourcefile, destinationfolder) { | |
var Stylus = child_process.spawn('stylus', ['-c','-u','nib','-w', sourcefile, '--out', destinationfolder]); | |
Stylus.stdout.pipe(process.stdout); // notifications: watching, compiled, generated. |
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 fs = require('fs'), | |
path = require('path'); | |
function watchStyles(sourcefile, destinationfolder) { | |
var exec = require('child_process').exec; | |
var cmd = `stylus -c -u nib -w ${sourcefile} -o ${destinationfolder}`; | |
exec(cmd, function(error, stdout, stderr) { | |
if (stdout) { | |
console.log(stdout); |
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
@extends('layouts.master') | |
@section('title') | |
Students | |
@stop | |
@section('page_header') | |
Students | |
@stop |
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 fs = require('fs'), | |
path = require('path'), | |
child_process = require('child_process'); | |
function watchStyles(sourcefile, destinationfolder) { | |
var Stylus = child_process.spawn('stylus', ['-c','-u', 'nib','-w', sourcefile, '--out', destinationfolder]); | |
Stylus.stdout.pipe(process.stdout); // notifications: watching, compiled, generated. |