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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.