Ticket #6436: loaddata_absolute_20080121a.diff
File loaddata_absolute_20080121a.diff, 2.6 KB (added by , 17 years ago) |
---|
-
django/core/management/commands/loaddata.py
65 65 else: 66 66 print "Skipping fixture '%s': %s is not a known serialization format" % (fixture_name, format) 67 67 68 for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']: 68 if os.path.isabs(fixture_name): 69 fixture_dirs = [fixture_name] 70 else: 71 fixture_dirs = app_fixtures + list(settings.FIXTURE_DIRS) + [''] 72 73 for fixture_dir in fixture_dirs: 69 74 if verbosity > 1: 70 75 print "Checking %s for fixtures..." % humanize(fixture_dir) 71 76 -
tests/regressiontests/fixtures_regress/fixtures/absolute.json
1 [ 2 { 3 "pk": "1", 4 "model": "fixtures_regress.absolute", 5 "fields": { 6 "name": "Load Absolute Path Test" 7 } 8 } 9 ] -
tests/regressiontests/fixtures_regress/models.py
1 1 from django.db import models 2 2 from django.contrib.auth.models import User 3 3 from django.conf import settings 4 import os 4 5 5 6 class Animal(models.Model): 6 7 name = models.CharField(max_length=150) … … 28 29 name = None 29 30 return unicode(name) + u' is owned by ' + unicode(self.owner) 30 31 32 class Absolute(models.Model): 33 34 name = models.CharField(max_length=40) 35 36 load_count = 0 37 38 def __init__(self, *args, **kwargs): 39 super(Absolute, self).__init__(*args, **kwargs) 40 Absolute.load_count += 1 41 42 31 43 __test__ = {'API_TESTS':""" 32 44 >>> from django.core import management 33 45 … … 49 61 >>> Stuff.objects.all() 50 62 [<Stuff: None is owned by None>] 51 63 64 ############################################### 65 # Regression test for ticket #6436 -- loading fixtures from absolute paths 66 67 >>> load_absolute_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'absolute.json') 68 >>> management.call_command('loaddata', load_absolute_path, verbosity=0) 69 >>> Absolute.load_count 70 1 71 52 72 """}