Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Conversation

@mutr
Copy link

@mutr mutr commented Dec 3, 2019

There is a chance that models will be sorted wrong if self-referencing model coexists with foreign models.

How to reproduce:

  1. Open project test.tar.gz
  2. Run statik --watch --no-browser -v several times.
2019-12-03 05:41:47,299 statik.database DEBUG   Unsorted models: ['File', 'Info', 'Tag']                                                                                                    
2019-12-03 05:41:47,300 statik.database DEBUG   Sorting round: 1 (['File', 'Info', 'Tag'])                                                                                                  
2019-12-03 05:41:47,300 statik.database DEBUG   Sorting round: 2 (['Tag', 'File', 'Info'])                                                 
2019-12-03 05:41:47,301 statik.database DEBUG   Sorted models: ['Tag', 'File', 'Info'] (2 rounds)                   
2019-12-03 05:41:47,301 statik.database DEBUG   Loading data for model: Tag                                                                                                                 
2019-12-03 05:41:47,303 statik.database DEBUG   Loading 3 instance(s) for model: Tag                                                                  
2019-12-03 05:41:47,303 statik.database DEBUG   StatikDatabaseInstance(model=Tag, pk=0, value=tag1)                                  
2019-12-03 05:41:47,313 statik.database DEBUG   StatikDatabaseInstance(model=Tag, pk=1, value=tag2)                                                   
2019-12-03 05:41:47,314 statik.database DEBUG   StatikDatabaseInstance(model=Tag, pk=2, value=tag3)                            
2019-12-03 05:41:47,314 statik.database DEBUG   Loading 0 instance(s) for model: Tag                                                                  
2019-12-03 05:41:47,317 statik.database DEBUG   Loading data for model: File                                                         
2019-12-03 05:41:47,324 statik.database DEBUG   Loading 4 instance(s) for model: File                                                                 
2019-12-03 05:41:47,324 statik.database DEBUG   Attempting to look up primary keys for ManyToMany field relationship: ['0', '1', '2']
2019-12-03 05:41:47,326 statik.database WARNING 0 not found in <class 'statik.database.Info'>                                                  
2019-12-03 05:41:47,327 statik.database WARNING 1 not found in <class 'statik.database.Info'>                                                                                               
2019-12-03 05:41:47,335 statik.database WARNING 2 not found in <class 'statik.database.Info'>```

Expected behaviour: `Sorted models: ['Info', 'Tag', 'File']`

There is a chance that model will be sorted wrong if self-referencing model coexists with foreign models.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant