Model Fieldname restrictions in Django Framework
A Django model is the built-in feature that Django uses to create tables, their fields, and various constraints. In short, Django Models is the SQL of Database one uses with Django. SQL (Structured Query Language) is complex and involves a lot of different queries for creating, deleting, updating or any other stuff related to database. Django models simplify the tasks and organize tables into models.
This article revolves around restrictions on models field names.
Django places some restrictions on Model Field Names.
First create the django project to see this restrictions
django-admin startapp myproj
Then create new app.
python manage.py startapp main
Add main app in settings.py inside the INSTALLED_APPS
Restrictions on Field Name –
1. Field name cannot be a python reserved word
2. A field name cannot contain more than one underscore in a row
3. A field name cannot end with an underscore