Вопрос по python – Добавление атрибутов в мета-класс модели Django

33

Error: User Rate Limit Exceeded

class Person(models.Model, DeepValues):
    name = models.CharField(blank=True, max_length=100)
    tribe = models.ForeignKey('Tribes')

    class Meta:
        schema = {
            'name' : str,
            'tribe' : {
                'name' : str
            }
        }

Person.objects.all().deep_values() => {
    'name' : 'Andrey Fedorov',
    'tribe' : {
        'name' : 'Mohicans'
    }
}

Error: User Rate Limit Exceededclass Meta с:

TypeError: 'class Meta' got invalid attribute(s): schema

Error: User Rate Limit ExceededВот)

Error: User Rate Limit Exceeded

Ваш Ответ

1   ответ
49

Error: User Rate Limit Exceeded

import django.db.models.options as options

options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('schema',)

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded Andrey Fedorov
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded Andrey Fedorov

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