I
I
Ingerniated2018-02-24 16:35:54
Django
Ingerniated, 2018-02-24 16:35:54

Is it a link to the file name?

Hi everyone, please advise.
django.dbthat's the name of the file, right?
what does the class hierarchy look like models.Model?
it would be easier to do

import django
class Musician(django.Models):

Or all these nuances are built on the object and everything looks
models = {
"Model" : class Model():
.... ,
"Hello" : class Hello():
....
}

Help break this moment.
from django.db import models

class Musician(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    instrument = models.CharField(max_length=100)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepan Krapivin, 2018-02-24
@Ingernirated

django , db and models are python modules.
Modules can be both a file and a folder with an __init__.py file inside.
Model is a class defined in one of the files in the django/db/models/ folder and imported in the django/db/models/__init__.py file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question