Login

Snippets by JustDelight

Snippet List

Proper fixtures loading in south data migrations

South documentation [contains a description](http://south.readthedocs.org/en/0.7.6/fixtures.html#fixtures-from-migrations) of the way you can load fixtures inside the data-migrations. def forwards(self, orm): from django.core.management import call_command call_command("loaddata", "my_fixture.json") It seems pretty clear and easy, but in fact it does not work the way you expect from south migrations, because the fixture loading does not engage the **orm** object. So, it allows **loaddata** management command to use standard models loading mechanism, and it would provide the most recent version of the models, obviously, which may not correspond to the schema of the fixture`s data. To be ensured that migration will use appropriate version of the models for fixture loading you could use code like follows: class Migration(DataMigration): def forwards(self, orm): load_fixture('my_fixture.json', orm) class Migration(DataMigration): def forwards(self, orm): with southern_models(orm): call_command("loaddata", "my_fixture.json")

  • fixtures
  • migration
  • fixture
  • south
  • datamigration
Read More

CitySelector

CitySelector is a jquery widget, allowing to pick cities from DB, filled by django_ipgeobase application. Also it includes widget for django forms, based on mentioned jquery plugin, views and urlconf, required to provide interaction between widget and DB and middleware, populating request with correspondent location. Visit https://bitbucket.org/JustDelight/city_selector

  • jquery
  • widget
  • geolocation
  • jqueryui
  • ru
  • django_ipgeobase
Read More

JustDelight has posted 2 snippets.