﻿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
21637	Defining objects of models having custom field without any parameter.	ANUBHAV JOSHI	nobody	"When we define any model, then we can create its object as obj=ModelClassName(). But when we define custom fields we just cannot do the same always. If we are using to_python() method, then it shows up error.


If a define my model as:

from django.db import models

class LField(models.Field):
    __metaclass__ = models.SubfieldBase
    def db_type(self, connection):
        return 'longtext'
    def to_python(self, value):
        return long(value)

class Person(models.Model):
    name = models.CharField(max_length=80, blank=True, null=True)
    something_else = LField()
class Person2(models.Model):
    name = models.CharField(max_length=80, blank=True, null=True)
    ph = models.CharField(max_length=80, blank=True, null=True)


Then it is not possible to define an object of Person type without giving parameters.
i.e.
p=Person() raises ValueError
p=Person2() works fine as it should like in case of any other class."	Bug	new	Database layer (models, ORM)	1.6	Normal				Unreviewed	0	0	0	0	0	0
