2008-3-25
| 22:49 | mattmcc | It's easy. |
| 22:49 | SzArAk | that would be awesome. |
| 22:49 | SzArAk | ok, i'll find that ;) |
| 22:50 | p-- | hey guys.. any ideas on this: http://dpaste.com/41291/ |
| 22:50 | dkbg | how does one display multiple model types in chronological order in a single list in a template? |
| 22:51 | FunkyBob | sort them in the view? |
| 22:52 | Magus- | p--: you should never trim stuff from models/views, you often remove a source of an error |
| 22:52 | Magus- | (not you specifically, but everyone who does that) |
| 22:52 | p-- | I will add the rest if you like.. but it really it centered on the date stuff I pasted.. (I cut out a lot of methods, etc.) |
| 22:52 | clarby | hmm, {% ifequal item.get_item_type_display "Comment" %} works, {% ifequal item.get_item_type_display|slugify "comment" %} doesn't, what am I not seeing? (and {% ifequal item.get_item_type_display|slugify comment %} always evaluates as true) |
| 22:53 | illustir | can somebody tell me the site that runs Ella CMS? |
| 22:53 | mattmcc | Never heard of it. |
| 22:53 | Magus- | p--: be sure you check how the data is being inserted into the chat model, and what's being returned |
| 22:53 | illustir | |
| 22:54 | Magus- | clarby: ifequal does not currently support filters |
| 22:54 | insin | dkbg: generic views can be useful for that if you have a table which holds the datetime for each model you're interested in - you need to do a bit of extra work to avoid getting tons of queries, though |
| 22:54 | Zal | p datetime.date can't be subtracted. Use datetime.datetime |
| 22:54 | illustir | there was a pretty nice Czech site that ran it |
| 22:55 | Magus- | Zal: look at the model defs, the one shouldn't be a date |
| 22:55 | Zal | hm |
| 22:55 | tahooie | If I set a property on a Model object I cant read the property back out without calling save() first. In my situation it would be really nice if I didn't have to save it first. Is there a way to do this? |
| 22:55 | dkbg | illustir: http://ellaproject.cz? |
| 22:55 | Magus- | tahooie: sounds like you did something wrong then |
| 22:56 | Magus- | obj.foo = 3 |
| 22:56 | Magus- | obj.foo |
| 22:56 | Magus- | that'll return 3 |
| 22:56 | illustir | dkbg, not it, but i mailed them |
| 22:56 | Magus- | unless you're doing something abnormal |
| 22:56 | moos3_ | I need some help for some reason some thing that use doesn't anymore http://dpaste.com/41292/ |
| 22:56 | tahooie | Magus-, well I'm interfacing with an old legacy system. I'd like to load up a django object with the data from the legacy DB and then call the functions i've already written for the django object - without saving it into the db. |
| 22:56 | clarby | Magus-: Ah, I see. That should probably be in the docs, if you happen to speak to any of the doc maintainers (or are one). |
| 22:57 | Magus- | tahooie: ...and? |
| 22:57 | Magus- | clarby: bugs are not documented |
| 22:57 | Magus- | why waste time writing docs for a bug when you can just fix it instead? |
| 22:57 | Magus- | it just takes time to get things in |
| 22:59 | tahooie | oh man, I could have sworn I had tried that and it didnt work. |
| 23:00 | Zal | p-- if you want help with an error, please paste *at least* the full traceback. |
| 23:00 | moos3_ | how come os.path.join(os.path.dirname(__file__), "template") doesn't work |
| 23:00 | Zal | p-- my guess is that the error is caused by get_dates(), not the line you are talking about |
| 23:00 | clarby | Magus-: Well, I don't know how many revisions have this bug, and I do understand that documenting bugs would clutter the docs. But if it spans several revisions, putting just one line of text there could save a lot of users time. |
| 23:01 | igors | my models.py could be a package? |
| 23:01 | Magus- | yes |
| 23:01 | igors | good :-) |
| 23:01 | mattmcc | moos3_: Works for me.. |
| 23:01 | Jimmy-James | moos3_: maybe you should import os so its defined |
| 23:01 | moos3_ | its in my settings.py |
| 23:02 | clarby | Magus-: And now I see why Django not supporting streaming of large uploads hasn't been documented. It too should though as it's something you'd expect to work, and not setting up your web server to prevent too large files makes any django app allowing uploads pretty vulnerable. |
| 23:02 | Zal | moos3_ you have to import os |
| 23:02 | moos3_ | ok |
| 23:02 | Magus- | clarby: no |
| 23:02 | moos3_ | that makes since |
| 23:02 | moos3_ | sense** |
| 23:02 | Magus- | clarby: the ticket tracker is right there |
| 23:02 | Magus- | its not like its hidden |
| 23:02 | Magus- | you can see bugs that exist same as look at docs |
| 23:02 | Zal | moos3_ also, you may want to use os.path.dirname(os.path.abspath(__file__)) for greater robustness |
| 23:03 | moos3_ | ok thanks |
| 23:04 | clarby | Magus-: Well, true. But, you don't check the ticket tracker for every feature you use, since everything else in Django is a smooth experience. |
| 23:04 | clarby | But, maybe that's just me :) |
| 23:04 | illustir | the site i was looking for is this: http://www.zena.cz/ |
| 23:05 | Jimmy-James | i like to keep it DRY if the ticket accounts for the bug, why duplicate and put it in the docs |
| 23:05 | p-- | Zal, sorry.. I will update it.. I am running through the code manually now in a shell and the get_dates is fine (it returns a Q object, and I use that method throughout the code base).. definitely the Chat models date objects are being saved as datetime.date instead of datetime.datetime.. I just added a new object and it saved as a datetime.date |
| 23:05 | Magus- | p--: did it happen to be a datefield in the past? |
| 23:05 | Magus- | if so, did you forget to update the db? |
| 23:05 | clarby | I'd say that particular bug should be advertised clearly, as It could down an entire shared server if a user allows uploads :) |
| 23:06 | Magus- | clarby: but they don't document bugs |
| 23:06 | Jimmy-James | mm |
| 23:06 | Magus- | I don't know why you would blindly assume it supported streaming uploads though |
| 23:06 | Magus- | nothing in the docs says it does, after all :) |
| 23:07 | p-- | date | date | not null |
| 23:07 | p-- | updated | timestamp with time zone | not null |
| 23:07 | p-- | shit, looks like it was a DateField() first |
| 23:07 | Magus- | sounds like that's the case |
| 23:07 | Magus- | heh |
| 23:07 | p-- | then moved to DateTimeField() |
| 23:07 | p-- | man.. I can't believe they didn't alter the table |
| 23:07 | p-- | thx guys! :) |
| 23:08 | clarby | Magus-: Well, the do a pretty good job making security notices about other security vulnerabilities. A notice about limiting upload sizes in the httpd config would only follow that pattern :) |
| 23:10 | tesseracter | arg, granular form output is tricky with all the different widgets i had been using. all i need is an format helper for a date/time field. |
| 23:10 | Magus- | format helper? |
| 23:11 | tesseracter | like help_text for admin, "Format: YYYY/MM/DD HH:MM:SS" |
| 23:11 | tesseracter | or whatever |
| 23:11 | Magus- | er, you mean like the help_text forms already support? |
| 23:13 | tesseracter | har har Magus-, i didnt restart my server :-P theyre all there. |
| 23:13 | clarby | tesseracter: my_date_field = forms.DateField(help_text="Format: YYY/MM/DD HH:MM:SS"), assuming you're creating the model from scratch. |
| 23:14 | tesseracter | thanks clarby, my problem was stupider than you give me credit for. |
| 23:14 | s3phiroth | Magus-: i'm still having a problem in that error_messages thing |
| 23:14 | s3phiroth | i made a mistake here: class Meta: model = UserProfile |
| 23:14 | s3phiroth | oops |
| 23:14 | s3phiroth | here: http://dpaste.com/41283/ |
| 23:15 | s3phiroth | how should i exactly access the fields attributes ? |
| 23:15 | s3phiroth | i tried self.fieldname.error_messages |
| 23:15 | moos3_ | does it matter is tabs are 8 spaces instead of 4 |
| 23:15 | Magus- | s3phiroth: fields are in self.fields, which is a dict |
| 23:15 | Magus- | moos3_: if they're actual tab characters, yes |
| 23:15 | lucas_x | quick question - How do I send POST data with an HttpResponseRedirect? |
| 23:16 | Magus- | python sees a tab as equivalent to 8 spaces |
| 23:16 | Magus- | so if you mix them, it won't work if you see a tab as 4 |
| 23:16 | Magus- | lucas_x: you dont, of course |
| 23:16 | moos3_ | ok |