#django

July 2nd, 2009

21:45 ejv
good eye andym, thanks for the help
21:45 aonweb
@neokeats, the admin manager can be replaced
21:45 aonweb
i think
21:45 rozwell
NeoKeats: now, that's not going to be terribly helpful to being with because managers essentially do one thing: build a queryset with the model they're managing, and pass through any methods called on them to this queryset
21:46 rozwell
NeoKeats: and as i've said several times now, QuerySet.delete doesn't use query.connection
21:46 rozwell
NeoKeats: so even if your manager is being used, it's not going to make any difference
21:47 NeoKeats
ok i see
21:48 rozwell
so what you would need to do is write a custom QuerySet class for your manager to return
21:48 NeoKeats
rozwell: so no solution...
21:49 rozwell
NeoKeats: there is a solution, just not one you want to hear
21:49 NeoKeats
rozwell: not using multidb ? or wait for branches multidb to be done (if not abandonned like before)
21:49 NeoKeats
?
21:50 rozwell
and the solution is to fix up all the places where the ORM assumes you want to use the global connection
21:50 pm2
I'm using an ImageField in a model, but setting the image file value from a script outside of the django app. Is there a function I can call to make Django update the height/width values for the image in the database?
21:50 rozwell
well you're going to have to wait or write your own solution
21:50 rozwell
pm2: it already does
21:51 pm2
rozwell: it's not doing that for me....
21:51 belred
when using {% url foo %} in templates, how can have be a variable and not a constant?
21:51 pm2
rozwell: the image file is getting set from a 3rd party script, not anything that's being executed as part of the web app
21:51 rozwell
pm2: it doesn't matter
21:51 NeoKeats
rozwell: (-: my actual solution didn't break django so i can still update it... i was thinking i could manage to keep it that way
21:51 belred
sorry, when using {% url foo %} in templates, how can have FOO be a variable and not a constant?
21:52 rozwell
pm2: if you save the model instance, the height and width fields should definitely get updated
21:52 pm2
rozwell: well... its not happening for me...
21:52 rozwell
NeoKeats: you could, but you're going to have to throw away contrib/3rd party stuff that you want to use something other than the global connection
21:54 rozwell
pm2: then you could try manually saving the file
21:54 pm2
rozwell: let me try a few things....
21:54 rozwell
pm2: saving the file attribute will update the image fields
21:54 rozwell
pm2: err image dimension fields
21:55 pm2
rozwell: let me paste a snippet of my models.py file somewhere... maybe I have it setup wrong
21:56 pm2
rozwell: http://dpaste.com/62674/ -- thumb_file is the field in question - does it look like I have it setup correctly at least?
21:56 rozwell
looks fine
21:57 SmileyChris
use CATION!
21:57 Dyresen
Why is it always late at night when you get creative at coding?
21:57 pm2
SmileyChris: well, fixed one bug anyway ;-)
21:57 rozwell
Dyresen: who says it is
21:58 pm2
rozwell: then I'm pretty confused here...
21:58 zephid
Dyresen: Maybe because the temperature gets under 20
21:58 pm2
rozwell: I'm excluding the height/width fields from the admin interface, that shouldn't make a difference, right?
21:59 Dyresen
zephid: could be, it's freaking hot here these days.
21:59 rozwell
pm2: what version of django are you using?
21:59 rozwell
pm2: and how is the field being updated?
22:00 belred
is it possible to have the {% url name %} name be a variable instead of a constant?
22:00 zephid
Dyresen: Same here, the temperature has been over 27 here in Denmark in the paste 6 days
22:00 SmileyChris
pm2: i think tehy are supposed to be strings
22:00 SmileyChris
pm2: looks like it according to source
22:01 SmileyChris
belred: nope
22:01 pm2
rozwell: django 1.0, field is being updated from a script. Basically, my project is to allow users to upload video files. I have a cron script that runs to convert the video files to .flv format. This script also creates a thumbnail image. This script is what updates the database with the thumbnail file
22:01 rozwell
pm2: i know it's a script, i'm asking how the code actually goes about updating it
22:01 rozwell
pm2: does it use the ORM?
22:02 pm2
rozwell: yes, I just import the django ORM
22:02 rozwell
belred: no
22:04 rozwell
pm2: it looks to be the case that this doesn't quite work right under django 1.0
22:04 ejv
someone made a django gedit theme! sweet!
22:04 ejv
:D
22:05 SmileyChris
pm2: did you read my message?
22:05 rozwell
django has a theme?
22:05 pm2
SmileyChris: yeah, I updated that, still have problems
22:05 synic
ejv: django has themes?
22:05 ejv
rozwell: django seems to sport the green irish colors lol http://code.djangoproject.com/wiki/gedit
22:10 pm2
rozwell: you want a look at my script? maybe that will shed some light on it? I tried uploading the thumbnail image through the admin interface and everything was uploaded correctly...
22:10 pm2
I mean *updated* correctly
22:13 rozwell
pm2: looking at the source i don't see the fieldfile getting saved except when it's done through a form
22:13 rozwell
pm2: this is not the case in trunk
22:13 pm2
so I should update
22:13 pm2
?
22:13 rozwell
that's one possibility
22:13 rozwell
or you could save the fieldfile data directly
22:14 rozwell
as that's what updates the dimension fields
22:18 pm2
rozwell: so just calculate the height/width manually and save it manually?
22:21 kiloecho7_
Does anyone know how to force a {% blocktrans %} tag to do a specific language besides LANGUAGE_CODE only for one blocktrans? Here's what I have already http://codepad.org/dwIFNuv4, it would be cool if I could get what's at the bottom.
22:26 rozwell
pm2: no
22:27 rozwell
pm2: model_instance.my_image_field.save()
22:28 pm2
rozwell: ah - i see - I'll give that a try
22:28 SmileyChris
wouldn't model_instance.my_image_field.update_dimension_fields() then model_instance.save() be enough?
22:28 SmileyChris
assuming that's not a trunkism
22:30 rozwell
well that's a trunkism
22:31 benc1
when using @login_required does it affect all the views in views.py ?
22:31 rozwell
benc1: if it's been applied to all the views in a views.py
22:31 gasull
Hi all. I'm trying to fix this problem with Apache and python-eggs: http://jjinux.blogspot.com/2008/10/python-permi... If I create a new user, how do I make my app work as that user? Thank you.
22:31 benc1
rozwell: in the docs there is an example for using it outside of the view function.
22:32 rozwell
benc1: and what does it say about it there?
22:32 benc1
rozwell: can't see anything.
22:33 rozwell
benc1: then what's the problem?
22:33 benc1
rozwell: when using login_required they are putting it inside the function but when using @login_required the put it outside
22:33 rozwell
benc1: i don't think they ever put it "inside the function"
22:33 benc1
rozwell: I want to limit access for all the functions in my views.py
22:33 rozwell
benc1: are you talking about the 2.4 decorator syntax differences?
22:34 rozwell
benc1: then apply login_required to all of them, or write a middleware
22:34 benc1
rozwell: how do I apply @login_required to all of them?
22:35 rozwell
benc1: you put that in front of each view function definition
22:35 benc1
rozwell: so here it will only affect my_view ? http://dpaste.com/62680/
22:35 rozwell
benc1: yes
22:35 benc1
rozwell: thanks
22:42 Zitter
sorry, what can I do if I haven't /media/ dir. I've entered in admin cpanel but it is not styled
22:47 juanefren
When I attempt to access any url I get this error :
22:47 juanefren
Caught an exception while rendering: bad marshal data
22:47 juanefren
What could It be ? (I'm not sure what it means)
22:59 multigl
I'm trying to deploy new django project as a fastcgi module and I've never seen this error before trying to start the server (I have 13 other projects deployed in exactly the same fashion)
22:59 multigl