D
D
doph2011-04-15 17:25:31
Django
doph, 2011-04-15 17:25:31

Syndb/south not seeing my models after refactoring?

I decided to change models.py to a module, because there were a lot of models and it was not very convenient to store everything in one file.
It turned out the models directory and the files with classes in it:

D:\~Sasha\eclipse_workspace\zavalen\picviewer\models&gt;dir *.py<br/>
Directory of D:\~Sasha\eclipse_workspace\zavalen\picviewer\models<br/>
<br/>
15.04.2011 16:38 1 125 cartItem.py<br/>
15.04.2011 16:43 1 283 Collection.py<br/>
15.04.2011 16:40 419 ImageSizeRatio.py<br/>
15.04.2011 16:43 876 Menu.py<br/>
15.04.2011 16:43 1 667 Order.py<br/>
15.04.2011 14:07 1 457 OrderForm.py<br/>
15.04.2011 16:43 490 OrderStatusHistory.py<br/>
15.04.2011 16:43 683 paperType.py<br/>
15.04.2011 16:43 3 202 Picture.py<br/>
15.04.2011 16:43 1 520 printSize.py<br/>
15.04.2011 16:43 687 PurchaseItem.py<br/>
15.04.2011 16:43 1 239 Tools.py<br/>
15.04.2011 16:11 0 __init__.py

I stuffed class Meta into each class so that it would be recognized as belonging to my picviewer application:
class cartItem(models.Model):<br/>
 picture = models.ForeignKey('Picture', null=False)<br/>
 paperType = models.ForeignKey('paperType', null=False)<br/>
 printSize = models.ForeignKey('printSize', null=False)<br/>
 quantity = models.IntegerField(default=1, validators=[validators.MinValueValidator(1)])<br/>
 price = models.DecimalField(decimal_places=2,max_digits=8)<br/>
 dateCreated = models.DateTimeField(null=False)<br/>
 sessionKey = models.ForeignKey(Session, to_field=&quot;session_key&quot;, null=False)<br/>
 user = models.ForeignKey(User,null=True)<br/>
<br/>
class Meta:<br/>
 app_label = 'picviewer'

After I did all this, I ran the standard south migration as I usually did:
manage_noDebug.py schemamigration picviewer --auto<br/>
manage_noDebug.py schemamigration migrate picviewer

She killed the old tablets, but did not create new ones.
Now, neither migration (tricks with --initial and so on), nor syncdb, nor cleaning up the database through flush helps - no plates are created. manage.py sql picviewer shows empty.
Where to dig? :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
doph, 2011-04-15
@doph

It was necessary to import all classes in __init__.py It
remains to understand why djanga is looking for models_menu tables, and not picviewer_menu, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question