2009-7-13
| 23:35 | ryan_ | yea for some reason i just coded that naturally but it looked wrong |
| 23:35 | Zenji | Bonjour :) |
| 23:35 | ryan_ | does django automatically iterate through that> |
| 23:36 | ryan_ | (the links member) |
| 23:36 | ryan_ | EyePulp, do you see what I am trying to do |
| 23:36 | ryan_ | EyePulp, yes menus and links will only be changed from the admin but I would like to be able to get the same results in the console |
| 23:37 | EyePulp | ryan_: I don't - and can't look at the moment - just wanted to pass along my experience, ie. there's no way to get updated m2m connections from within the .save() |
| 23:37 | EyePulp | =) |
| 23:37 | ryan_ | EyePulp, the same problem exists then? |
| 23:37 | EyePulp | yup |
| 23:38 | ryan_ | EyePulp, okay is there some standard workaround or should i make this a cron job? |
| 23:38 | ryan_ | first user forces it? |
| 23:38 | EyePulp | ryan_: save() twice? |
| 23:38 | SmileyChris | ryan_: how do the menus/links get updated? |
| 23:39 | EyePulp | ryan_: I could be totally off base, so ignore me for the moment - listen to the others. |
| 23:40 | Iradieh_ | SmileyChris: What I said earlier happened |
| 23:40 | Iradieh_ | SmileyChris: It replaced all the pictures with the same picture |
| 23:40 | SmileyChris | Iradieh_: well you're doing it wrong then |
| 23:40 | Iradieh_ | SmileyChris: ok, but I don't think it processes the text more the once |
| 23:40 | SmileyChris | it doesn't need to |
| 23:41 | Iradieh_ | It just goes through it once, and relaces [[ picture "name" ]] with the same picture all over the place |
| 23:41 | SmileyChris | then you're doing it wrong |
| 23:41 | Iradieh_ | SmileyChris: it does because it requires multiple checkups |
| 23:41 | Iradieh_ | I am probaly, yes |
| 23:41 | SmileyChris | Iradieh_: post the code |
| 23:42 | Iradieh_ | hold on going to change some stuff |
| 23:44 | ryan_ | does anyone know if in overriding a Model save, you immediately call parent.save(), would an updated many to many table be ready there? |
| 23:44 | ryan_ | whereas in signals this is a known bug? |
| 23:45 | ryan_ | or feature not available w/e |
| 23:45 | FunkyBob | ryan_: again, I don't believe changes to a m2m table are part of an object save... they are a separate action |
| 23:45 | FunkyBob | hence why you do it with separate code |
| 23:46 | FunkyBob | reinforced by the fact you must save a new model BEFORE you can set any m2m fields |
| 23:46 | Iradieh_ | SmileyChris: http://gist.github.com/146533 |
| 23:46 | Iradieh_ | SmileyChris: That works, but again, I might be wrong or the code looks horrible (I know, I will fix the regexp later) |
| 23:48 | SmileyChris | Iradieh_: firstly, match is wrong - you should be using .search() |
| 23:49 | ryan_ | why can't I do super(Link, self).save() |
| 23:49 | Iradieh_ | SmileyChris: Okay? But as I said, it actually works good this time |
| 23:49 | ryan_ | i understand your point about that not occruing at the same time |
| 23:49 | SmileyChris | Iradieh_: it won't run the sub unless there is a "picture xxxx" right at the start of the content |
| 23:49 | FunkyBob | ryan_: because you're not passing args, for a start |
| 23:49 | Iradieh_ | SmileyChris: I know, as I said, the regexp is crap for now.. |
| 23:50 | ryan_ | so how can Django guarantee an updated many to many table? |
| 23:50 | Iradieh_ | But the system does it jobb.. |
| 23:50 | ryan_ | i mean it must occur by mechanism in the same transaction? |
| 23:50 | SmileyChris | Iradieh_: other hints, '\w' == '[A-Za-z0-9_]' and you don't need to use '__exact' |
| 23:52 | Iradieh_ | does \w include _ (underline?) |
| 23:52 | ryan_ | okay nevermind i just read the bug description more carefully |
| 23:52 | Iradieh_ | Ok, sorry I didn't know, (Ruby doesn't) |
| 23:52 | Iradieh_ | SmileyChris: Anyway I changed to sub too. |
| 23:52 | Iradieh_ | SmileyChris: do you wanna see it? (I mean the page) |
| 23:52 | FunkyBob | ryan_: if you take control of transactions, it will |
| 23:53 | SmileyChris | Iradieh_: lastly, you aren't escaping very nicely |
| 23:53 | Iradieh_ | SmileyChris: Hmm What do you mean? I want to have HTML there.. |
| 23:54 | Iradieh_ | SmileyChris: the "code" is like picture starwars picture bush picture oranges (with some text between) |
| 23:55 | ryan_ | FunkyBob, have you tried any of the patches? |
| 23:55 | SmileyChris | Iradieh_: read through http://docs.djangoproject.com/en/dev/howto/cust... |
| 23:55 | Iradieh_ | SmileyChris: I have... |
| 23:55 | Iradieh_ | Whats wrong with my escaping |
| 23:55 | FunkyBob | ryan_: what patches? |
| 23:55 | Iradieh_ | Thats how I got the safe_mark() |
| 23:55 | SmileyChris | Iradieh_: you shouldn't use is_safe, because you are introducing non-safe characters |
| 23:56 | FunkyBob | ryan_: start again... what's your actual goal here? |
| 23:56 | Iradieh_ | SmileyChris: ok, but I want those non-safe to be visible? |
| 23:56 | ryan_ | FunkyBob, it's exactly the problem in this bug http://code.djangoproject.com/ticket/5390 |
| 23:56 | SmileyChris | Iradieh_: mark_safe is fine |
| 23:57 | Iradieh_ | SmileyChris: Did you see the page? |
| 23:57 | FunkyBob | ryan_: what is YOUR actual goal here? what is the overall action YOU are trying to achieve? |
| 23:57 | FunkyBob | not HOW... WHAT |
| 23:57 | Iradieh_ | SmileyChris: I am glad :D it worked! I haven't been able to find something like this on djangosnippets.. I am thinking of adding it (my first contribution) |
| 23:57 | SmileyChris | Iradieh_: yep |
| 23:57 | SmileyChris | you'd have to make it a bit more generic, and add tests - but sure |
| 23:57 | FunkyBob | and if you want to watch a m2m, can it be dealt with via a through? |
| 23:58 | ryan_ | I am trying to cache the menu's xhtml every time someone alters a link at all or a menu at all. (which in reality shouldn't be often) |
| 23:58 | ryan_ | I am creating an app called staticpages |
| 23:58 | ryan_ | it adds a menu component to the mix |
| 23:58 | ryan_ | and makes it easier for a cleitn to change their own content |
| 23:58 | FunkyBob | ok |
| 23:59 | ryan_ | it is very similar to flatpages, uses the same middleware mechanism |
| 23:59 | FunkyBob | is generating the menu proving to be that expensive? |
| 23:59 | ryan_ | no |
| 23:59 | ryan_ | i guess i'm guilty of optimizing before just doing |
| 23:59 | FunkyBob | then why are you caching it? |
| 23:59 | ryan_ | trying to be fancy i don't know |
| 23:59 | ryan_ | it just seems like right thing to do |
Page 31 of 31
← Previous
(3,084 total)