Django rest framework with access and refresh token.
Django rest framework simple jwt doc here.
Django rest framework doc here.

Step 1: Preparation, Create Django Project, Initial Migration
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
install drf: pip install djangorestframework
install drf simplejwt: pip install djangorestframework_simplejwt
Create Django…

Simple customization for language and timezone in django admin. By default django language is English and UTC Timezone. We can change to another language and timezone. Here’s the example, Language Bahasa Indonesia, timezone: GMT+7 (Jakarta’s Time). Official docs for Django internationalization and localization here. …

Export data in django admin into excel spreadsheet, csv and other format using django-import-export library. Official docs here.

Step 1: Preparation, Create Django Project, Initial Migration
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0 django-import-export
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Initial Migration: python manage.py…

Simple Django upload file
Official doc here.

Step 1: Preparation, Create Django Project, Initial Migration
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Initial Migration: python manage.py migrate

Step 2: Create Django Apps
Create…

Simple use of widget in django form with bootstrap html.
Official doc here.
Bootstrap official doc for form here.

Step 1: Preparation, Create Django Project, Initial Migration
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Initial Migration: python manage.py…

Basic read and write file with python 3.x.

test.txt

This is first line content.
This is second line content.
This is third line content.

Open and Read Files

file = open('test.txt', 'r')
print(file.read())
file.close()

‘r’ means read, it is default value, we can use file = open(‘test.txt’) as well . use file.close() to close file.

output:

This is first line content.
This is second line content.
This is third line content.

Write/Create File

f = open('test2.txt', 'w')
f.write('This is line content.')
f.close()

‘w’ means create new or overwrite file content. We can use ‘a’ for append in the end of file content.

Add favicon from static folder to base.html in django

Preparation:
Step 1: Setup static folder.

Step 2: Setup base.html

Step 3. Add file icon *.ico in static/images
Example icon filename: book.ico

Step 4. Modify base.html (we use cdn bootstrap template)

<link rel="shortcut icon" href="{% static 'images/book.ico' %}">

Adi Ramadhan

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store