Opened 18 years ago
Closed 18 years ago
#4231 closed (fixed)
manage.py loaddata problem if app name is Capitalised
Reported by: | Owned by: | Russell Keith-Magee | |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
Severity: | Keywords: | loaddata | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
System: Apache2.2.4, mod_python3.3.1, Python-2.5.1, postgresql-8.2.4, psycopg2-2.0.5.1, latest django version.
Models:
class VenueType(models.Model): venueTypeName = models.CharField(maxlength=200, db_index=True) venueTypeSlug = models.SlugField(prepopulate_from= ('venueTypeName',), db_index=True) class Admin: pass class Venue(models.Model): venueSlug = models.SlugField(prepopulate_from=('venueName',), unique=True, db_index=True) venueType = models.ManyToManyField(VenueType, filter_interface=models.HORIZONTAL)
Process:
./manage.py dumpdata --format=json Guide > guide.json [Clear database] ./manage.py syncdb ./manage.py loaddata guide.json
Error:
Loading 'test' fixtures... Installing json fixture 'test' from absolute path. Installed 1 object(s) from 1 fixture(s) Traceback (most recent call last): File "./manage.py", line 11, in <module> execute_manager(settings) File "/opt/python/lib/python2.5/site-packages/django/core/ management.py", line 1674, in execute_manager execute_from_command_line(action_mapping, argv) File "/opt/python/lib/python2.5/site-packages/django/core/ management.py", line 1588, in execute_from_command_line action_mapping[action](args[1:], int(options.verbosity)) File "/opt/python/lib/python2.5/site-packages/django/core/ management.py", line 1418, in load_data cursor.execute(line) File "/opt/python/lib/python2.5/site-packages/django/db/backends/ util.py", line 12, in execute return self.cursor.execute(sql, params) File "/opt/python/lib/python2.5/site-packages/django/db/backends/ postgresql/base.py", line 44, in execute return self.cursor.execute(sql, [smart_basestring(p, self.charset) for p in params]) psycopg.ProgrammingError: ERROR: relation "guide_venuetype_id_seq" does not exist SELECT setval('Guide_venuetype_id_seq', (SELECT max("id") FROM "Guide_venuetype"));
Test file:
[{"pk": "1", "model": "Guide.venuetype", "fields": {"venueTypeSlug": "stadium", "venueTypeName": "Stadium"}}]
./manage.py sqlall Guide output:
BEGIN; CREATE TABLE "Guide_venuetype" ( "id" serial NOT NULL PRIMARY KEY, "venueTypeName" varchar(200) NOT NULL, "venueTypeSlug" varchar(50) NOT NULL ); CREATE TABLE "Guide_venue" ( "id" serial NOT NULL PRIMARY KEY, "venueName" varchar(200) NOT NULL, "venueSlug" varchar(50) NOT NULL UNIQUE ); CREATE TABLE "Guide_venue_venueType" ( "id" serial NOT NULL PRIMARY KEY, "venue_id" integer NOT NULL REFERENCES "Guide_venue" ("id") DEFERRABLE INITIALLY DEFERRED, "venuetype_id" integer NOT NULL REFERENCES "Guide_venuetype" ("id") DEFERRABLE INITIALLY DEFERRED, UNIQUE ("venue_id", "venuetype_id") ); CREATE INDEX "Guide_venuetype_venueTypeName" ON "Guide_venuetype" ("venueTypeName"); CREATE INDEX "Guide_venuetype_venueTypeSlug" ON "Guide_venuetype" ("venueTypeSlug"); CREATE INDEX "Guide_venue_venueName" ON "Guide_venue" ("venueName"); CREATE UNIQUE INDEX "Guide_venue_venueSlug" ON "Guide_venue" ("venueSlug"); COMMIT;
Link to Google Groups Django Users Discoussion:
Loaddata-issue
I hope this is enough information.
Change History (2)
comment:1 by , 18 years ago
Component: | Uncategorized → Serialization |
---|---|
Owner: | changed from | to
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Problem confirmed to exist in [5152]. Problem only occurs if app has a capitalized name; changing the name to lower case (i.e. guide, not Guide) works fine.
Issue seems to be in deriving the naming of the PostgreSQL sequence for the primary key of the table being loaded.