WebFaction
Community site: login faq

Hello World!

So heres my problem:

I'm using a mysql database. I want to add another column to one of the tables in it, and have successfully done so from the mysql interface on the control panel. Do I have to do something special to get it to show up in my models.py file? Because my function aren't "seeing" the new column in the table.

Thanks, Sean

asked 06 Nov '10, 10:00

Sean Lambert
261616
accept rate: 25%

edited 06 Nov '10, 11:14

seanf
12.2k41836

When I say it doesn't "see" the new column, I mean that when I try to call the table (eg. Object.newColumn), it says something along the lines of Object doesn't have attribute/item newColumn

(06 Nov '10, 10:11) Sean Lambert

Did you add new field to your models.py before (or after, it doesn't matter) you added the column to your table?

Judging from the error (missing attribute) you haven't done this yet.

(06 Nov '10, 10:15) David L ♦♦

Yeah. I'm really still new to this. So far, every time I needed to add something to the database i just updated models.py, deleted the DB, the did syncdb again (i know, i'm terrible). But now that I've launched I can't afford to lose the data already the DB. Thanks for the help. I just made identical changes to models.py and the DB and now it works.

Thanks!

(06 Nov '10, 10:18) Sean Lambert

You should probably look into using South to manage your DB schema updates.

permanent link

answered 06 Nov '10, 11:13

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×84

question asked: 06 Nov '10, 10:00

question was seen: 2,368 times

last updated: 06 Nov '10, 11:14

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM