It seems pretty arbitrary to write models something like this:
from django.db import models class Foo(models.Model): name = models.CharField(max_length=100, null=False) class Meta: ordering = ("name")
Is there any reason class Meta:, not class Meta(object):? Is there any reason not to inherit explicitly from object?
class Meta:
class Meta(object):
object
Like Stephen, note that since version 2.0, Django only supports Python 3; in this version of Python there is no need to inherit from the object, all classes are automatically "new style".
Inheritance with objectdoes not matter. Template:
class Foo(): class Meta: attribute = 'This is Interesting'
First of all, it’s easier to do than later code:
if Foo.Meta.attribute == 'How Boring': ....
Meta, Meta, , .
Meta
Source: https://habr.com/ru/post/1691003/More articles:Affirm that an event has been observed - javascriptGoogle Cloud Feature Error: "Unable to decode type from Firestore value" - javascriptJPMS/Jigsaw Отсутствует основной класс в модуле - javaУстановка SKPM (Sketch Plugin Manager) через npm - node.jsAsync / Await vs Parellel.For, which is better in this case? - multithreadingWPF - Reducing the flooding effect for a button - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1691005/how-to-programmatically-map-integers-to-const-strings&usg=ALkJrhhw_SfgXJUHoscDlAMDaqU7lmfx9gHow to redirect another page after successfully logging in to nodejs - javascriptfinal variables do not function well in jshell - access-modifiersVisual Studio 2015 - errors in * .d.ts files in node_modules folder - ecmascript-5All Articles