﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
239	Initializing a model instance should not require fields with blank	maurycy	Adrian Holovaty	"{{{
   1.
      [maurycy@localhost ~]$ export DJANGO_SETTINGS_MODULE='model_test.settings.main'
   2.
      [maurycy@localhost ~]$ cat model_test/apps/test/models/test.py
   3.
      from django.core import meta
   4.
       
   5.
      class Test(meta.Model):
   6.
          fields = (
   7.
              meta.IntegerField('number', 'number', blank=True, default=666),
   8.
          )
   9.
          admin = meta.Admin()
  10.
      [maurycy@localhost ~]$ django-admin.py sqlall test
  11.
      BEGIN;
  12.
      CREATE TABLE test_tests (
  13.
          id integer NOT NULL PRIMARY KEY,
  14.
          number integer NOT NULL
  15.
      );
  16.
      INSERT INTO packages (label, name) VALUES ('test', 'test');
  17.
      INSERT INTO content_types (name, package, python_module_name) VALUES ('test', 'test', 'tests');
  18.
      INSERT INTO auth_permissions (name, package, codename) VALUES ('Can add test', 'test', 'add_test');
  19.
      INSERT INTO auth_permissions (name, package, codename) VALUES ('Can change test', 'test', 'change_test');
  20.
      INSERT INTO auth_permissions (name, package, codename) VALUES ('Can delete test', 'test', 'delete_test');
  21.
      COMMIT;
  22.
      [maurycy@localhost ~]$ django-admin.py install test
  23.
      [maurycy@localhost ~]$ python
  24.
      Python 2.4.1 (#1, May 16 2005, 15:19:29)
  25.
      [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
  26.
      Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
  27.
      >>> from django.models.test import tests
  28.
      >>> test = tests.Test(id=None)
  29.
      >>> test.save()
  30.
      Traceback (most recent call last):
  31.
        File ""<stdin>"", line 1, in ?
  32.
        File ""/usr/lib/python2.4/site-packages/django/core/meta.py"", line 87, in _curried
  33.
          return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))
  34.
        File ""/usr/lib/python2.4/site-packages/django/core/meta.py"", line 737, in method_save
  35.
          f.pre_save(self, getattr(self, f.name), add)
  36.
      AttributeError: 'Test' object has no attribute 'number' 
}}}"	defect	closed	Metasystem		normal	fixed			Unreviewed	0	0	0	0	0	0
