#23699: Migrate in unittest still loads initial data -------------------------------------+------------------------------------- Reporter: tony-zhu | Owner: nobody Type: Bug | Status: new Component: Core (Management | Version: 1.7 commands) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 0 Needs tests: 1 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by tony-zhu): Replying to [comment:4 andrewgodwin]: > The problem I was encountering was that people would have one initial_data migration for a project containing entries for all models in a project - not just the ones in the specific app (as it's common to just "dumpdata" to a single fixture file) > > In particular, while you can make flush only load the initial_data from apps without migrations, you cannot prevent people from putting instances of models with migrations into those initial_data files. > > Thus, while you can modify flush to only load unmigrated apps, it's of limited use in actually preventing the error occurring in the initial ticket. That said, I don't see why it can't be fixed, and then documented as such, it might be a little less surprising. I understand that one app could load initial data for other apps with migrations. There is no way we could prevent that. The only solution might be abandon the whole loaddata command for Django 1.7+ apps. However, my propose flush command change does make sense for some reusable Django apps that could be dropped to any existing Django project. In my case, it is Django-helpdesk (https://github.com/rossp/django-helpdesk), which people just pip install it and put it into installed apps. Supporting both Django 1.6+South and Django 1.7+ will require such apps to have both old initial_data and the new migration based initial data. -- Ticket URL: <https://code.djangoproject.com/ticket/23699#comment:6> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.c709673de1a5ead527313ac58c4298b5%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.