2009-7-1

22:24 apollo13
billy_maze: django can't use more than one database (not yet), so the question is somewhat useles
22:24 apollo13
christopher22: grrrrrrrrrr
22:24 rastem
chris22: so you did try to change it to instance.id and it didn't work?
22:24 christopher22
apollo13 I know you don't wan't me to use that script
22:24 christopher22
that didn't work then it gives me None.. but that's explained in the django doc
22:25 kuatto
is there a way to derive a Q instance from a QuerySet instance?
22:25 christopher22
In most cases, this object will not have been saved to the database yet, so if it uses the default AutoField, it might not yet have a value for its primary key field.
22:25 christopher22
this it what the django docs says about instance.id
22:25 billy_maze
apollo13: I know Django does not support multiple databases
22:25 rastem
ok, but then not sure why form.save(commit=false) doesn't solve your problem.
22:25 christopher22
but I don't wan't the id of the model Photos.. I want the id of the user that's currently logged in
22:26 apollo13
christopher22: that doesn't work either? http://dpaste.com/62256/
22:26 rastem
chris22 right, hence user_id
22:26 billy_maze
apollo13: I just want to know if it would be better (performance, wise) if the the chat logs where to be separate from the User profile database
22:26 apollo13
christopher22: that's not related to your user.id problem
22:26 christopher22
in get_image_path() i'm calling on instance.user_id
22:26 apollo13
that's only related to Photo_instance.id in this case
22:26 christopher22
user_id isn't set yet.. that's happends a line later when I use: instance.user = request.user
22:26 rozwell
christopher22: instance.user.id
22:26 apollo13
billy_maze: I wouldn't care for now…
22:26 apollo13
rozwell: forget it, I am trying to tell him this since an hour
22:26 christopher22
rozwell that return DoesNotExists
22:27 apollo13
christopher22: did you try the snippet I just posted?
22:27 rastem
I'm thinking you need to save the form with commit = false to set the foreign key relationships first
22:27 apollo13
rastem: no
22:27 apollo13
instance.user.id will work
22:27 rozwell
christopher22: i don't see how
22:27 apollo13
if instance.user is valud
22:27 rozwell
christopher22: if we've got a logged in user, then we've certainly got the user's id
22:28 apollo13
rozwell: the error is obscure, but he is using 1.0.2 which had some file problems iirc
22:28 christopher22
your traceback: http://dpaste.com/62257/
22:28 christopher22
about the DoesNotExists
22:29 apollo13
christopher22: Photos() instead of Photo() of course in my paste
22:29 christopher22
it clearly states "DoesNotExists" somehow it's unable to get the user id from the ForeignKey relationship
22:29 apollo13
christopher22: wrong
22:30 christopher22
well I changed everything to Photos()... it just didn't help apollo13
22:30 apollo13
unless you missed to paste the Exception Value
22:30 christopher22
Exception Type: DoesNotExist
22:30 apollo13
christopher22: you get doesnotexist with my paste? then your django install is broken
22:30 christopher22
Exception Value: is empty
22:30 apollo13
or you ran into a 1.0.2 bug
22:30 apollo13
as said, try 1.1
22:31 rastem
this bug is totally weird. I don't see from the code why this error exists. All I see is the instance.user_id ref needing to be instance.user.id
22:31 rastem
or instance.user.pk
22:31 christopher22
apollo13, what paste are you now talking about?
22:31 apollo13
rastem: no, if he uses form.save(commit=false) it will fail, no matter what
22:31 apollo13
<apollo13> christopher22: that doesn't work either? http://dpaste.com/62256/
22:31 apollo13
that one
22:32 apollo13
I doubt you will get a DoesnoeExist error
22:32 rastem
apollo13: just verified, you're correct.
22:32 christopher22
that dpaste doesn't call upon the upload_to path so it never reaches the function get_image_path
22:32 christopher22
2 error in the Django 1.0.2 version?
22:32 apollo13
why 2? that's one ;)
22:33 christopher22
well i'll try to install Django 1.1 Beta
22:33 apollo13
yeah
22:33 apollo13
I just checked with the django source code
22:33 christopher22
how could easily remove django when it's not installed through trunk?
22:33 apollo13
my snippet should work
22:33 apollo13
rm
22:34 christopher22
owkay
22:34 rastem
chris, or svn the 1.1 beta then symlink the django install in your python path
22:34 rastem
that way switching back to 1.0.2 is easy as updating symlink
22:35 rastem
also makes automating this via bash command easy, good for testing.
22:35 christopher22
been trying to get svn working for weeks.. well not svn but the symlink part
22:35 christopher22
not really keen on that part of configuring django with python
22:36 apollo13
christopher22: the django installation docs should describe that
22:36 christopher22
already on that page.. trying the svn co part now
22:37 rastem
chris: django as a package is linked somehow in your python's site-packages folder. What I find most useful, is to svn co django into a directory with all my other packages
22:37 rastem
and do an ln -s and set up a symbolic link inside the site-packages to the django folder of the version I downloaded
22:38 rastem
this also allows me to switch from package to package for testing compatibility and ease of rollback
22:39 rastem
because changing the symbolic link from going to /home/me/django-trunk/django to /home/me/django-beta-trunk/django is a single command
22:39 apollo13
rastem: that's what virtualenv is for
22:39 apollo13
I am running three version in paralell hear
22:39 apollo13
here*
22:40 christopher22
when i'm using this command: ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django
22:40 zalun|w
apollo13: with this custom fields admin widgets - it's not so easy as I thought - is there any doc?
22:40 NeoKeats
christopher22: http://docs.djangoproject.com/en/dev/topics/ins... refers to creating the symlink
22:40 apollo13
zalun|w: I fear not, just the sourcecode
22:40 christopher22
it says: ln: target `/usr/local/lib/python2.6/site-packages/django' is not a directory
22:41 NeoKeats
try to force : ln -sf `pwd`/django-trunk/django SITE-PACKAGES-DIR/django
22:41 rastem
apollo13: I've actually never heard of that, and sounds cool will read up more
22:41 zalun|w
apollo13: as it is jumping through many files - I was following the source code and created all fields, but it still renders as the old default
22:41 apollo13
:) well create a formfield and a widget for it and return that in your model.formfield
22:41 apollo13
that should do it
22:42 apollo13
model.formfield should read modelfield.formfield
22:42 zalun|w
basically I want to display a thumbnail instead of Currently: uploads/xxx.jpg
22:42 apollo13
ahh :)
22:42 apollo13
there are docs for that
22:42 apollo13
django admin docs
22:42 apollo13
formfield_for_dbfield is the method you want
22:44 apollo13
gn8
22:44 rastem
so I'm supposing there's no way to save an object into django's session? Perhaps with something akin to Marshal in ruby?
22:45 Drakonen
rastem: pickeling?
22:45 m1chael
i see django has a way of generating rss feeds... what if i want to DB a feed?
22:46 zalun|w
22:46 rastem
Drakonen: true. thoughts on safety / security of storing these objects in session? i.e. I want to store a query object in session, should that be trusted?
22:46 rastem
and if not, ideas on methods of screening it
22:46 Drakonen
why not just store the values?
22:48 rastem
trying to find a way to save 'state' of a page, just found it easier to save the object with all it's function calls / results / etc already intact
22:48 rastem
instead of having to do the work twice
Page 24 of 25   ← Previous  Next →(2,473 total)