It is.
Then how comes it's creating classes differently
It is not? I think it would be helpful if you could show what you mean. I guess you might be confused by the fact that models only have fields (usually) in them.
Yes am confused on how django defines it's classes in the models.py file. I find it conflicting with pythons conventional way of defining a class
So, django models gets **kwargs on it's init. that's where it parses the fields. Nothing special about it. Also, nothing prevents you from overriding the init.
I don't see **kwargs here. Or where is it located?
django.db.models.Model
I can't find that file, do you have any link from the internet? This is all i could find https://docs.djangoproject.com/en/2.0/_modules/django/db/models/fields/files/
https://github.com/django/django/blob/main/django/db/models/base.py#L476
I might be tempted to create a child class without using the init function just to check if it will work the way it worked in django
I guess you need to learn about dataclass
This did not work for me though
Will that help me achieve this? Can you write a short code to illustrate it?
class AccessKwargs: def __init__(self, *args, **kwargs): print(kwargs) test = DataClass(worked='wow, it worked')
There is no child class here? I mean there is no inheritance anywhere in that code
Обсуждают сегодня