Похожие чаты

But i think django is python?

16 ответов

5 просмотров

It is.

Bruce-Minanga Автор вопроса
Gian
It is.

Then how comes it's creating classes differently

Bruce Minanga
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.

Bruce-Minanga Автор вопроса
Gian
It is not? I think it would be helpful if you coul...

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

Bruce Minanga
Yes am confused on how django defines it's classes...

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.

Bruce-Minanga Автор вопроса
Gian
So, django models gets **kwargs on it's init. that...

I don't see **kwargs here. Or where is it located?

Bruce-Minanga Автор вопроса
Gian
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/

Bruce Minanga
I can't find that file, do you have any link from ...

https://github.com/django/django/blob/main/django/db/models/base.py#L476

Bruce-Minanga Автор вопроса
Gian
https://github.com/django/django/blob/main/django/...

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

Bruce-Minanga Автор вопроса
Bruce-Minanga Автор вопроса
Gian
I guess you need to learn about dataclass

Will that help me achieve this? Can you write a short code to illustrate it?

Bruce Minanga
Will that help me achieve this? Can you write a sh...

class AccessKwargs: def __init__(self, *args, **kwargs): print(kwargs) test = DataClass(worked='wow, it worked')

Bruce-Minanga Автор вопроса
Gian
class AccessKwargs: def __init__(self, *args, ...

There is no child class here? I mean there is no inheritance anywhere in that code

Похожие вопросы

Обсуждают сегодня

А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
1
Подскажите, где смотреть результат выполнения программы? Код: ;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, станда...
Егор Анелькин
5
Где в Астане можно купить мясо для шашлыков?
Dancing Іңұқәһүғө
21
Hi I have recently invested in ewt . Any way to stake it ?
K ì V
11
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
Добрый день подскажите пожалуйста может кто то сталкивался с ошибками Sentry 22.10.0 развернутым из helm чарт в Kubernetes? Изначально 3 дня назад очень стало много событий ух...
Tire4 Finist Devops
1
Ну чё, сегодня все в гавно?))
ᅠ🚀
20
Карта сайта