Django 1.5.4 sql generation just generates one model field (PostgreSQL)

34 views
Skip to first unread message

Jorge Arevalo

unread,
Apr 3, 2014, 6:24:39 PM4/3/14
to django...@googlegroups.com
Hello,

I have this dummy models.py

from django.db import models

class Foo(models.Model):
    bar = models.IntegerField(),
    // more integer fields here...
    xyz = models.IntegerField()

And I want to know the SQL code generated for PostgreSQL, executing:

python manage.py sqlall myapp

No south involved. Just Django 1.5.4. And this is the SQL output

BEGIN;
CREATE TABLE "myapp_foo" (
    "id" serial NOT NULL PRIMARY KEY,
    "xyz" integer NOT NULL
)
;

COMMIT;

Just the internal id and the last specified field were generated. The rest are ignored. No matter how many fields or what fields. Just takes the last one, and generates that output.

Does it make any sense? I'm running Django 1.5.4 under a virtualenv, using Python 2.7 in Ubuntu 12.04. This is the complete output of pip freeze in my virtualenv

Django==1.5.4
Jinja2==2.7.1
MarkupSafe==0.18
PIL==1.1.7
Pygments==1.6
Sphinx==1.1.3
Unipath==1.0
argparse==1.2.1
distribute==0.6.24
django-admin-tools==0.5.1
django-appconf==0.6
django-bootstrap3==2.0.0
django-colorful==0.1.3
django-compressor==1.3
django-extensions==1.2.5
django-geojson==2.1.1
django-guardian==1.1.1
django-leaflet==0.8.2
django-model-utils==1.5.0
django-secure==1.0
django-sorting==0.1
django-waffle==0.9.2
docutils==0.11
feedparser==5.1.3
psycopg2==2.5.1
requests==2.0.1
six==1.4.1
wsgiref==0.1.2

This is just... weird. Any clues?

Many thanks in advance

François Schiettecatte

unread,
Apr 3, 2014, 6:34:38 PM4/3/14
to django...@googlegroups.com
You have a comma at the end of this:

bar = models.IntegerField(),

Could that be the issue?

François
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3ab753c1-96eb-4386-b031-dbc61aeeec9d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

signature.asc

Jorge Arevalo

unread,
Apr 4, 2014, 2:11:16 AM4/4/14
to django...@googlegroups.com
Absolutely! It's working now. What a stupid mistake... Many thanks!
Reply all
Reply to author
Forward
0 new messages