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
# In form.py | |
from django.forms.util import ErrorList | |
from django.utils.safestring import mark_safe | |
class ErrorListMsg(ErrorList): | |
def __unicode__(self): | |
return self.as_msg() | |
def as_msg(self): | |
if not self: return u'' |
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
#In form.py | |
#The original source for this : http://djangosnippets.org/snippets/1303/ | |
from django import forms | |
from django.template.defaultfilters import filesizeformat | |
from django.utils.translation import ugettext_lazy as _ | |
# 2.5MB - 2621440 | |
# 5MB - 5242880 | |
# 10MB - 10485760 |
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
/* The original source: http://www.the-art-of-web.com/javascript/validate-date/ */ | |
//obj is JQuery object | |
// return : true -- time invalid, false -- time valid | |
function checkTime(obj){ | |
var errorFlag = false; | |
re = /^(\d{1,2}):(\d{2})(:00)?([apAP][mM])?$/; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<style> | |
summary::-webkit-details-marker{ | |
color:green; | |
} | |
</style> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<!--[if lt IE 9]> | |
<script src="dist/html5shiv.js"></script> | |
<![endif]--> | |
<title>HTML5 Shim</title> | |
<style> | |
article{ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<style> | |
.container{ | |
width:100%; | |
box-sizing:border-box; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<style> | |
li.pass{ | |
color:green; | |
} | |
li.fail{ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<style> | |
.pass{color:green;} | |
.fail{color:red;} | |
</style> | |
</head> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> | |
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]--> | |
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]--> | |
</head> |
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
SUFFIXES = { | |
1000: ['KB','MB','GB','TB','PB','EB','ZB','YB'], | |
1024: ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'] | |
} | |
def approximate_size(size, a_kilobyte_is_1024_bytes = True): | |
'''Convert a file size to human-readable form. | |
Keyword arguments: | |
size --- file size in bytes |
OlderNewer