Hi,
I'm migrating my Flask app to a Django app. In cases of the models, it's a little different between both. In Flask, you have to put id and in Django it's not necessary. I'm showing you the difference between Flask and Django while creating models. It's important to say that I was using Flask_SQLAlchemy to make my models. Django has a pattern library that comes along the framework.
Flask:
from flask_sqlalchemy import SQLAlchemy
class Friend(db.Model):
__tablename__ = "friends"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
address = db.Column(db.String, nullable=True)
Django:
from django.db import models
class Friend(models.Model):
name = models.CharField(max_length=100)
address = models.CharField(max_length=64, default=None)
As you can see, in Django is a little simpler to make models. You only have to put the max_length. The NULL statement is equal to say default=None in Django models.
Anytime,
Igor