you could only assign a Field variable in the Model, "time" absolutely not a Field, the error appears.
-- luthur On Thursday, July 12, 2012 at 9:51 PM, Jaroslav Dobrek wrote: > Hello, > > how can I design a model such that two fields are set to the same value when > a new object of the type defined by the model is created? > > Example: > > class Test(models.Model): > start_time = models.DateTimeField() > end_time = models.DateTimeField() > time = start_time > > > Users may create Test objects in order to run their own tests. A test always > starts at some date time and it always ends at some date time. Each test has > a time which is increased until it equals the end time. When a user creates a > new test (and before he uses it) the field time should have the same value as > the field start_time. > > The code above will produce a database error. > > Jaroslav > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/ekl9tv3zHTIJ. > To post to this group, send email to django-users@googlegroups.com > (mailto:django-users@googlegroups.com). > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > (mailto:django-users+unsubscr...@googlegroups.com). > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.