Fields | null=True | blank=True |
---|---|---|
CharField, TextField, SlugField, EmailField, CommaSeparatedIntegerField | DON'T Django's convention is to store empty values as the empty string, and to always retrieve NULL or empty values as the empty string for consistency. | OK Do this if you want the corresponding form widget to accept empty values. If you set this, empty values get stored as empty strings in the database. |
BooleanField | DON'T Use NullBooleanField instead. | DON'T |
IntegerField, FloatField, DecimalField | OK If you wabt to be able to set the value to NULL in the database | OK if you want the corresponding form widget to accept empty values. if so out will also want to set null=True |
DateTimeField, DateField, TimeField | OK if you want to be able to set the value to NULL in the database. | OK If you want the corresponding form widget to accept empty values, or if you are using auto now or auto now add. If so, you will al |
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
// add this code to your StartupModule() function of your EDITOR module | |
// if it doesnt work, try setting loading phase to "postdefault" -- no idea if this will produce side effects though. | |
// basically idea is looping all CDOs (i.e. UClasses) and their properties, getting their "category" meta value and registering them to | |
// property sections | |
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor"); | |
static constexpr bool bAddSubcategories = false; // you probably want this to be false | |
auto ProcessCategory = [&PropertyModule](const FName ClassName, const FString& Category) |
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
############################## | |
## POSTGRESQL BACKUP CONFIG ## | |
############################## | |
# Optional system user to run backups as. If the user the script is running as doesn't match this | |
# the script terminates. Leave blank to skip check. | |
BACKUP_USER= | |
# Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified. | |
HOSTNAME= |
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
body.swagger-body { | |
background: #3b4151; | |
} | |
h1, h2, h3, h4, h5, h6, pre {color: #fff!important;} | |
.swagger-ui .scheme-container { | |
background: #3b4151; | |
} |
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
server{ | |
listen 80; | |
server_name example.com; | |
access_log /home/path_to_site/access.log; | |
error_log /home/path_to_site/error.log; | |
location / { | |
proxy_pass http://0.0.0.0:8002; | |
proxy_set_header Host $host; |
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 threading | |
from .models import Crawl | |
def startCrawl(request): | |
task = Crawl() | |
task.save() | |
t = threading.Thread(target=doCrawl,args=[task.id],daemon=True) | |
t.start() | |
return JsonResponse({'id':task.id}) |
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
// Usage: | |
// | |
// colorShader(10, '#f50'); // brighten color 10% | |
// colorShader(-10, '#f50'); // darken color 10% | |
// | |
// colorShader(10, '#f50', '#0ad74e'); // blend two colors | |
// colorShader(10, 'rgb(210, 200, 20)', 'rgb(20,156,210)'); // blend two colors | |
const colorShader = (ratio=10, color1, color2 = false) => { | |
let p = ratio / 100; |
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
ps -ylC apache2 | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' |
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
class PostAdmin(CssClassMixin, admin.ModelAdmin): | |
form_css_clasess = { | |
'title': 'col-sm-8', | |
'slug': 'col-sm-12' | |
} |
NewerOlder