Re: migration via south for inheritance change -> please help
> and I do
> for fruit in Fruits.objects.all(): fruit.rott()
>
> will anything happen at all? I know in C++ this would work... ;-)
>
> on database-level I know how to do it, I just don't know if the django
> abstraction handles this automalically.
I.. don't know. I'd think yes, at least I wonder otherwise how does
the DB keep coherent if you do
BaseModel.objects.filter(foo=bar).delete(). "CASCADE" would deal with
it in PG, but mysql sometimes lacks that, and sqlite doesn't handle
foreign keys at all.
but you probably need to make some tests to make sure. It'd be quite
easy to do it from the shell
> Seems I have too little faith in the capabilities of python ;-)
Yah, and about that.. what you said WOULD work for any Objects of a
subclassed class in python, as it would in C. Actually, since you
don't declare types in python, you don't really know the class of your
parameters unless you ask, it is the concept of duck-typing that gets
used strongliest in python (you ask the parameter to respond to a
certain interface, you don't care what type it is).
The question is not whether python is able to know what the real class
of an object is, but rather whether django knows the real model of an
object it got from a supermodel's table.
my_fruit.apple returns the corresponding Apple instance, and
my_fruit.orange returns the corresponding Orange instance, but if you
call my_fruit.orange on an object that actually represents an Apple,
you'll get an Orange.DoesNotExist exception raised. But this behavior
is lazy (the Orange table doesn't get hit in the database until you do
.orange).
--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde
|_|0|_|
|_|_|0|
|0|0|0|
(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home