views:

49

answers:

3

I added some models in my models.py and I want to add an admin class to use a wysiwyg-editor in text-fields.
Well, I know that Django itself doesn't support migrations and I've used South, but it doesn't work either.
South doesn't "see" the change.
Could it be, that South just detects changes to fields, but not if I add a new class?
How can I tweak Django to detect such changes?

+2  A: 

syncdb and South are only concerned with descendants of Model in apps listed in INSTALLED_APPS. Everything else is handled by Django directly.

Ignacio Vazquez-Abrams
But if I add an Admin Class or a Meta-Class to the Model, how does Django see it? I thought that Django just reads the database and not models.py
x0rg
Why would it *not* read models.py? That module contains Python code, and Django is written in Python.
Ignacio Vazquez-Abrams
+1  A: 

I'm fairly sure that if you follow the steps as outlined in the tutorial to create an admin app it'll just work. Migration isn't an issue as the admin app creates new tables rather than altering the existing one.

Amos
+1  A: 

You seem to be very confused, unfortunately. Of course Django reads the code in models.py - otherwise what would be the point of it? Django uses that code initially to define the model SQL when doing syncdb, but it doesn't modify existing database tables in subsequent calls to syncdb - hence the need for South.

But naturally, Django uses models.py and admin.py and all the other Python code to define its own configuration and state. (And note that admin classes are not defined in models.py but in admin.py.)

If you are not seeing changes, you will need to restart your server.

Daniel Roseman
Thanks, that helps me a lot. I couldn't test it actually, but I will once I get the opportunity.
x0rg