Skip to content

Instantly share code, notes, and snippets.

@kachmul2004
kachmul2004 / field_blank_null.md
Created January 21, 2023 09:33 — forked from ekinertac/field_blank_null.md
Django null/blank field explanation
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
@kachmul2004
kachmul2004 / CELERYCONFIG.md
Last active December 6, 2022 21:53 — forked from hamzaakhtar953/CELERYCONFIG.md
Configuring Celery + Redis + Supervisor with Django

Configuring Celery + Redis + Supervisor with Django

Install Celery

$ pip install celery
$ pip install redis

Install Celery Broker

@kachmul2004
kachmul2004 / deep_transform.py
Created April 23, 2022 11:47 — forked from martin056/deep_transform.py
Deep snake_case and camelCase transformations
import re
from typing import Dict, Callable, Optional
def to_camel_case(snake_case_str: str) -> str:
"""
Transforms snake_case to camelCase
"""
components = snake_case_str.split('_')
titled_components = ''.join(x.title() for x in components[1:])
@kachmul2004
kachmul2004 / MainActivity.java
Created August 20, 2021 13:52 — forked from rachitmishra/MainActivity.java
Parsing XML on android using XML pull parser
package in.xmlparser;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;