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 Em sáb, 3 de nov de 2018 às 09:39, oganga chantal <ogangachan...@gmail.com> escreveu: > need help with creating models for my django app, > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/fde1cd1f-7d1e-4ac0-94d0-a41b06e9516f%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/fde1cd1f-7d1e-4ac0-94d0-a41b06e9516f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFTRX_KmZsCgAD4nOeznfu029%2BLiPANqTX_kA5%3D4VSPUkFCS%3DQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.