2008-8-8

21:53 Magus-
uh, no
21:54 eRAZOR
thought so because cache_control also allows to specify the timeout
21:54 doctormo
Hmm it doesn't look like it's possible to get the form or field from a widget during render... that kind of makes things hard to do context based widgets.
21:54 Magus-
eRAZOR: cache_control is for headers sent to the browser
21:54 eRAZOR
a I see
21:54 Magus-
like don't cache this for X time
21:54 eRAZOR
yep
21:54 Magus-
or whatever
21:55 Magus-
doctormo: correct, widget does not know of form or field
21:55 mattmcc
doctormo: You can make your own widget & field to pass whatever information you need into the widget.
21:56 doctormo
mattmcc: yes but the form context is needed for the data available to the form to be available to the widget. It doesn't work logically
21:56 eRAZOR
so it looks like I need to use both decorators to be on the safe side
21:59 d00gs
what's the best way to do an ordered many-to-many? order_with_respect_to on an intermediary model?
21:59 Magus-
to do an ordered m2m you must define the join table yourself and not use the m2m field, last I checked
21:59 d00gs
so doing it with a through won't work?
22:00 mattmcc
If it doesn't, that'd be an interesting feature to attempt, since ordered m2m's are a fairly common need.
22:00 d00gs
yeah, i figured it would be
22:00 d00gs
ok, i'll play around, just wondering if there was a "best practice"
22:01 Magus-
through?
22:01 Prometheus
looks like I'm in for quite a bit of reading :)
22:01 Magus-
did I miss that ticket merging again?
22:01 d00gs
it merged like a week or two ago
22:01 d00gs
i think
22:01 mattmcc
You blinked. :)
22:06 doctormo
Hmm, I fixed my problem by getting ajax to make further requests on page load, although it'd very wasteful, it seems the only way to get around the context restrictions.
22:07 mattmcc
That's unlikely.
22:07 mattmcc
I have custom forms that pass all sorts of extra data down to the widget.
22:12 _Gast_84_
22:12 _Gast_84_
22:12 _Gast_84_
22:13 hydrapheetz
*ker BONK*
22:13 thunderbolt
Yay!
22:19 quantumsummers
anyone know a nice way to iterate over form fields?
22:20 quantumsummers
in python that is
22:20 mattmcc
The form.fields collection?
22:20 Magus-
a normal for loop over it like any dict?
22:20 Magus-
(regarding form.fields)
22:21 quantumsummers
giving us unsubscriptable error on a commented out line in the loop
22:21 Magus-
perhaps if you tried showing us your code
22:21 mattmcc
You're doing it wrong.
22:21 Magus-
instead of wanting us to guess at it
22:22 quantumsummers
BoundField is unsubscriptable
22:22 mattmcc
It's true, it's not.
22:22 Magus-
well yah, it isn't
22:22 Magus-
so stop trying to do somefield[0] or such
22:24 quantumsummers
form_as_div ftw
22:24 Magus-
?
22:28 Glenjamin
if thats all you want just make an as_div mixin for your forms
22:28 Eloff
I've read in several places now that cherrypy 3 has a faster pure python WSGI server than mod_python, could django be run on that?
22:28 mattmcc
Um, mod_wsgi? :)
22:29 Eloff
mattmcc, good point, I'd be surprised if cherrypy is faster than mod_wsgi, but I guess anything is possible until you measure
22:29 doctormo
mattmcc: then can you perlpaste your code so I can see them, I can't quite see how you can get variables out of scope to be submitted to widgets/fields
22:30 HenrikV
has tried to have a named url say name="home", where {% url home %} throws an exception ?
22:31 mattmcc
doctormo: Well, maybe if you mentioned what exactly you're trying to access.. Since you haven't done that yet.
22:31 HenrikV
form_as_dl > all others :)
22:31 doctormo
mattmcc: No I did, I said I wanted to access form data at widget rendering time.
22:35 eRAZOR
is there a convenient way to monitor the status of the django cache system?
22:35 mattmcc
doctormo: So from a form's __init__, you can grab the data argument and pass it through self.fields['foo']
22:35 mattmcc
...or not.
22:36 Magus-
eRAZOR: what status?
22:36 mattmcc
eRAZOR: That'd depend on the backend. I imagine there are lots of monitoring tools for memcached.
22:36 mattmcc
And since that's the only backend worth using in production, that should suffice. ;)
22:36 eRAZOR
magus: number of items in the cache .. perhaps with a summery per cache_key domain (string based)
22:36 eRAZOR
something like that
22:37 Magus-
eRAZOR: django keeps no such record like that
22:37 Magus-
so its up to your backend, as mattmcc said
22:37 eRAZOR
nothing fancy .. just to get a grasp on whats going on
22:37 eRAZOR
ok
22:38 eRAZOR
I'm pretty certain that there are monitoring solutions for memcached but since I'm currently developing with the django builtin cache backend, I thought I ask
22:38 coulix
Hi, i get a strange error with no debugging template on this small piece of "simple" code http://dpaste.com/70277/ any hints on what could it be ?
22:39 Magus-
you're returning a string
22:39 Magus-
obviously that won't work
22:39 Magus-
line 13
22:39 mattmcc
coulix: Looks like you meant to use a redirect response.
22:40 coulix
please hit me .... time to sleep
23:19 Ceddy
hey all, slightly strange question, but i have a model, and want a method which lists all the methods attached to that model, any ideas how to access this?
23:19 mattmcc
dir()
23:20 mattmcc
But wouldn't reading the documentation be easier?
23:20 Glenjamin
will django-admin work if its in a different directory?
23:20 Glenjamin
(ie. can i copy it to python\scripts)
23:21 Ceddy
mattmcc: is dir() directed at me?
23:21 horza
Hmm, if you try and extend a template using the name it doesn't exclude itself and goes into infinite loop
23:21 mattmcc
horza: Right, only one template can exist with a given name.
23:22 horza
glenjamin: Why don't you put a symbolic link in python/scripts?
23:22 mattmcc
Ceddy: Yep.
23:22 horza
mattmcc: So how do I over-ride an admin template, when all I want to do is add a couple of lines?
23:23 mattmcc
horza: That depends. Some admin views look for a series of templates, such as the model change forms.
23:23 Glenjamin
hrm, symlink will work
23:23 mattmcc
For others, you'd just have to copy the template somewhere and override the admin one entirely.
23:24 Ceddy
thanks, essentially we are expanding the no. of fields all the time, and i dont want to keep sotring all the info twice, so just want a list of all the fields as i need it else where in the code....
23:24 mattmcc blinks.
23:24 horza
mattmcc: over-riding entirely makes maintenance a bit of a nightmare. I guess I could create a whole load of change_form_xxx and put includes in each
23:26 stp2007
I have an app being accessed directly and through Facebook. I'm trying to figure out how to allow the direct urls to be app\view\ and FB urls to be FB\app\view\. Tried a regular expression in root.py during the include of the app.urls but that didn't work although my regex foo sucks so that could be it. Thoughts?
23:29 horza
mattmcc: No, admin/objectname/change_form.html still goes into infinite loop
23:29 horza
mattmcc: I'll hack it into base.html :-(
23:30 Killarny
I have three models that are sharing one abstract model, and one model which relates to all three - how can I give that model a foreignkey to three other models, dependant upon which of the three is in use?
23:30 Killarny
I've tried linking to the abstract model, but that doesn't work .... am I being dense?
23:30 trhaynes
Is there an easy way to deploy two instances of my project such that they share the same code but use different databases?
23:31 mattmcc
trhaynes: Sure, it's just a matter of settings.
23:31 stp2007
Page 27 of 28   ← Previous  Next →(2,746 total)