Skip to content

Instantly share code, notes, and snippets.

View mthri's full-sized avatar
🦄

Amir Motahari mthri

🦄
View GitHub Profile
@mthri
mthri / Model.md
Last active March 27, 2020 23:28
Extend User class in django

Extend User class in django

Notic :

If you have foreign key in new filds,must allow null(like below) or set default value else don't work

from django.db.models.signals import post_save
from django.dispatch import receiver

class Role(models.Model):
    RoleID = models.IntegerField(primary_key=True)
 name = models.CharField(max_length=10)
@mthri
mthri / django-orm.md
Last active February 27, 2020 21:28
Django ORM

Making queries with Django ORM

Official tutorial

from django.db import models

class Blog(models.Model):
    name = models.CharField(max_length=100)
    tagline = models.TextField()
@mthri
mthri / SocketClient.ino
Last active August 29, 2024 14:05
esp8266 socket client and python socket server
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
const uint16_t port = 8585;
const char *host = "SERVER-IP";
WiFiClient client;
void setup()
{
Serial.begin(115200);