These are chat archives for django/django

21st
Aug 2015
Samuel Spencer
@LegoStormtroopr
Aug 21 2015 12:41
So great news! The django models to ERD app is now available on pip using pip install django-spaghetti-and-meatballs. To celebrate, I'm drinking :wine_glass:!!!
Kevin Morales
@iKenshu
Aug 21 2015 14:24
Hey guys, im trying to do the Django tutorial but i have a error when im trying to migrate
Mir Nazim
@mnazim
Aug 21 2015 14:25
@iKenshu what’s the error?
Kevin Morales
@iKenshu
Aug 21 2015 14:26
CREATE INDEX "polls_choice_7aa0f6ee" ON "polls_choice" ("question_id");
ALTER TABLE "polls_choice"
  ADD CONSTRAINT "polls_choice_question_id_246c99a640fbbd72_fk_polls_question_id"
    FOREIGN KEY ("question_id")
    REFERENCES "polls_question" ("id")
    DEFERRABLE INITIALLY DEFERRED;

COMMIT;
i cant's see those lines in my terminal
i see
INSERT INTO "polls_choice__new" ("choice_text", "votes", "id", "question_id") SELECT "choice_text", "votes", "id", NULL FROM "polls_choice";
DROP TABLE "polls_choice";
ALTER TABLE "polls_choice__new" RENAME TO "polls_choice";
CREATE INDEX "polls_choice_7aa0f6ee" ON "polls_choice" ("question_id");

COMMIT;
Mir Nazim
@mnazim
Aug 21 2015 14:27
This is not an error, but SQL statement that will create your db tables. What command did you run?
Kevin Morales
@iKenshu
Aug 21 2015 14:27
python manage.py makemigrations
Mir Nazim
@mnazim
Aug 21 2015 14:28
Please page the output of python manage.py migrate —list here
Kevin Morales
@iKenshu
Aug 21 2015 14:29
admin
 [X] 0001_initial
auth
 [X] 0001_initial
 [X] 0002_alter_permission_name_max_length
 [X] 0003_alter_user_email_max_length
 [X] 0004_alter_user_username_opts
 [X] 0005_alter_user_last_login_null
 [X] 0006_require_contenttypes_0002
contenttypes
 [X] 0001_initial
 [X] 0002_remove_content_type_name
polls
 [ ] 0001_initial
sessions
 [X] 0001_initial
i don't know why not create foreign key :c
Mir Nazim
@mnazim
Aug 21 2015 14:31
migrations are already there. please python manage.py migrate to apply them to db
[X] menas migration is applied to db
[ ] means migration needs to be applied with manage.py migrate command.
Kevin Morales
@iKenshu
Aug 21 2015 14:32

i got this error now

django.db.utils.OperationalError: table "polls_choice" already exists

Mir Nazim
@mnazim
Aug 21 2015 14:35
to options. If you are sure all tables related to polls app are created, you can just run python manage.py migrate --fake. If not, you might need to remove polls_* tables.
Take a look at django_migrations table in the db. Data in it will tell you a lot about how migrations are recorded. It’s pretty straight forward.
Kevin Morales
@iKenshu
Aug 21 2015 14:54
Thanks for your help @mnazim :P
Mir Nazim
@mnazim
Aug 21 2015 14:54
:thumbsup: