Найти - Пользователи
Полная версия: This field is required.
Начало » Python для новичков » This field is required.
1
and_07
MODELS
class Section(models.Model):
    id = models.AutoField(primary_key=True)
    parent = models.ForeignKey('self', default=None,blank=True, null=True)
    name = models.CharField(max_length=100, unique=True)
    visible = models.BooleanField(db_index = True,default=True) 
class Blog(models.Model):
    id = models.AutoField(primary_key=True)
    section_id = models.ForeignKey(Section, default=None,blank=True, null=True)
    description = models.TextField(blank=True)
    created = models.DateTimeField(auto_now_add=True)

ADMIN
from myproject.blog.models import Blog,Section
from django.contrib import admin
admin.site.register(Blog)
admin.site.register(Section)   

При попытке сохранить в админке получаю
Please correct the error below.

This field is required.

на полях parent и section_id
ilnur
может default None убрать? там же и так null=True
and_07
тема закрыта default не влиял
ilnur
а что влияло?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB