|
I'm having a problem making my first Django Model class save(). I keep getting an AttributeError with the message: 'Foo' object has no attribute 'id' The docs make it pretty clear that you don't have to specify an id field, that it'll add one for you if you don't, so what could be keeping it from working? I'm using a Manager, I have a Meta class that sets a different db_table and an __init__ that sets all the fields, but nothing else that's all that complicated. Any ideas? Also, I just started using Python last week to play around with the Google App Engine and got hooked on Django this week, it's pretty sweet. Seems to make things just about as easy as possible, I think. Except, of course, when none of your objects will save
|
# ¿ Apr 19, 2008 08:36 |
|
|
# ¿ Apr 30, 2024 02:58 |
|
bitprophet posted:Please paste (or pastebin, e.g. dpaste.com) your model code? Hard to troubleshoot without. http://dpaste.com/45833/ I changed it __init__ to a method, in case that was the problem, and it appears to at least be getting further. Now the problem is: code:
|
# ¿ Apr 19, 2008 21:17 |
|
deimos posted:Try switching the 0 and 1 to true and false, maybe it forgets to do a type check before turning it into a string. Not sure if SQLite shits itself when you try to set a boolean field to 0 or 1. Which 0 and 1s? The only boolean field I have is already set with True and False. _aligns is a dictionary, and I need to store the index of the matching key, not the value of it. It's a dictionary because later on when I output the results I'll want the full value and not the abbreviated one that's in the logs. ImJasonH fucked around with this message at 22:06 on Apr 19, 2008 |
# ¿ Apr 19, 2008 22:02 |
|
deimos posted:Your code somewhat stinks of SAVAGELY OPTIMIZED overtones. You're probably right, I could probably save myself a lot of trouble by just storing strings in the database instead of ints. In fact, yeah, I'm going to tweak this some and simplify.
|
# ¿ Apr 20, 2008 00:13 |
|
deimos posted:I am not against storing ints where ints are due, but making them small or large really isn't saving you a lot. Still I'd love to know if it's some sort of backend issue with django so that a proper ticket can be opened. Not a backend issue, just my own stupidity. I was passing a list of strings to killed_by because i r dum.
|
# ¿ Apr 20, 2008 03:07 |
|
|
# ¿ Apr 30, 2024 02:58 |
|
politicorific posted:I can define "englishdictionary" in views.py to be any letter I want, but how do I get django to determine the variable based on the url? I think Named Groups is the solution, read the section on them here Basically, change the line in urls.py to: code:
code:
ImJasonH fucked around with this message at 05:33 on May 4, 2008 |
# ¿ May 4, 2008 05:24 |