Skip to content

Instantly share code, notes, and snippets.

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

mdimai666 mdimai666

🏠
Working from home
View GitHub Profile
@flaugher
flaugher / gist:ec36ec940a31707ac683
Created March 1, 2015 20:03
Things to do if your Django form.is_valid() method fails
- Check that you inserted "request.POST" as an argument to your form when instantiating the form in your view after the POST.
- Add {{ form.errors }} {{ form.non_field_errors }} to the form or debug your view and print them from the debugger.
- Examine each form field in the debugger: myform['<fieldname>'].value()
- Make sure DEBUG = True so that you'll see any server errors.
- Check your server log.
- If all else fails, step through the is_valid() call.
@romanzaycev
romanzaycev / pagination.jade
Last active May 14, 2020 07:38
Jade (Pug) Bootstrap pagination mixin (Digg-like pagination)
mixin pagination(adjacents, numPages, display, currentPage, base)
- adjacents = (adjacents || 1) * 1;
- numPages = (numPages || 10) * 1;
- currentPage = (currentPage || 1) * 1;
- base = base || '#';
- display = (display || 7) * 1;
ul.pagination
if numPages < display + adjacents * 2
- var p = 1;
@termitkin
termitkin / functions.php
Created September 16, 2019 13:21
[WordPress] Allow to upload .rar files
function allow_upload_rar ($mime_types = array()) {
$mime_types['rar'] = 'application/x-rar';
return $mime_types;
}
add_filter('upload_mimes', 'allow_upload_rar');