2008-3-4
| 22:40 | cooltool | ;) .. that is one of the nice bits of django .. |
| 22:40 | vad3R | i started with django yesterday. i'm not familar with all the details |
| 22:40 | Magus- | have you even done the tutorial? |
| 22:40 | Magus- | if not, I would fix that |
| 22:41 | vad3R | i'm currently reading the djangobook |
| 22:41 | sakkaku | @ Magus-: Would you need to define the ID for use in a foreign key? I am still learning django and some of that behavior ins't the best documented. |
| 22:41 | cooltool | drop the id .. from the model .. than try your delet again should work .. you can do the dleet in one line as well .. with .delet at the end i think |
| 22:41 | Magus- | http://www.djangoproject.com/documentation/tuto... <- start here instead, vad3R |
| 22:42 | vad3R | ok. i'll give it a try and work through the tutorial :-) |
| 22:42 | Magus- | sakkaku: why on earth would you need to define the id when an fkey was involved as opposed to normally? |
| 22:42 | Magus- | that makes no sense at all |
| 22:42 | Magus- | vad3R: are there any other models involved in this setup though? its entirely possible its a cascading delete erroring |
| 22:43 | Magus- | also, use a pastebin with highlighting and select the right source type so that it highlights :) |
| 22:43 | vad3R | without the id it works. Thanks a lot. |
| 22:44 | vad3R | upcoming problems will be pasted the right way... :-) |
| 22:44 | sakkaku | Magus-: Whoops, I see it now the foreignkey in django points to the other model, doh |
| 22:46 | Magus- | not 'in django' that's just how they work |
| 22:47 | cooltool | hehe |
| 22:47 | sakkaku | I know, I am just not thinking clearly :\ |
| 23:01 | spankalee | i'm getting a ValueError with sqlite and a DateTimeField. The values were imported, and they're in the standard format (i think,) like "2004-7-30 0:0:0.0" |
| 23:02 | spankalee | the error is cause by the date part being parsed into a list of 3 empty strings by Django |
| 23:02 | spankalee | any ideas? |
| 23:05 | schnuffle | strptime( date_string, format) from datetime module |
| 23:15 | dcode | is it possible to use the permalink decorator if you pass your views as objects instead of strings? |
| 23:15 | smitten_by_djang | trying to server my django site on apache mod-python alone (yeah, I will later will try to serve the media files with other tool like nginx, but I wanted to make it work with apache only first)... and here is my apache config file... the problem is I can access the main site, but the media files were not accessible...so I see the main site without any js and css, which i stored in my media.. |
| 23:15 | smitten_by_djang | http://dpaste.com/37977/ -.... my apache config |
| 23:16 | Magus- | dcode: sure, just use the same reference |
| 23:16 | Zalamander | smitten_by_djang SetHandler None was right |
| 23:16 | dcode | Magus-, so do I need to just import the views module and pass the same object? |
| 23:16 | dcode | it didn't seem to work for me. I might have the imports screwy |
| 23:16 | Zalamander | smitten_by_djang (and get rid of the rest, under Location /media) |
| 23:16 | Magus- | dcode: no, I mean use the reference as if you were using a string |
| 23:16 | Magus- | "project.app.views.viewname" |
| 23:17 | smitten_by_djang | any ideas what might be wrong? |
| 23:17 | dcode | ah |
| 23:17 | bowen0507 | Could someone tell me how to get the foreign key information from this articles = ObjectPaginator(Article.objects.order_by('-created'), 10)? I have an image table that links by a foreign key to an Image table |
| 23:17 | Magus- | smitten_by_djang: you're being given ideas - pay attention |
| 23:17 | EyePulp | heh |
| 23:17 | Magus- | smitten_by_djang: also, change line 14 to read sebsib.settings instead of settings, and remove /var/www/django_root/sebsib from line 15 |
| 23:19 | dcode | lol....duh.....thanks Magus- ....sometimes my mind doesn't like to believe the intuitive technique will work b/c it's too easy :p |
| 23:19 | bkeating | I've asked this before, but it's still unclear to me - if im including a "user login" menu across many pages, of various depth, how can I prepend to the links "?next=" based on the page im on? I would like my users to go right back to that page after they logout. |
| 23:20 | Magus- | you mean append, not prepend |
| 23:20 | Magus- | and you simply make sure request.path is in context, then use that |
| 23:20 | SmooveB | bkeating: I usually scrape it out of referers. |
| 23:20 | Magus- | ^ absolutely horrible method |
| 23:20 | Magus- | referer is not guaranteed to be there, nor guaranteed to be accurate if it is |
| 23:20 | Magus- | some software firewalls even replace it with an advertisement |
| 23:21 | bkeating | Magus-: good idea. ?next={{request.path}} or sthing to that effect |
| 23:22 | Magus- | smitten_by_djang: also, adding /usr/lib/python2.5/site-packages/django to pythonpath is very wrong :) |
| 23:23 | aebersold | Does someone know a framework for asynchronous job processing? |
| 23:23 | schnuffle | cron :) |
| 23:24 | Zalamander | the subprocess module |
| 23:25 | bkeating | Magus-: where in the docs can I learn about request.path and other Context? It's a view thing but can't find info |
| 23:25 | Magus- | request.path has nothing to do with context |
| 23:25 | Magus- | |
| 23:26 | bkeating | Magus-: sorry, thanks |
| 23:29 | aebersold | Zalamander: Is it no problem to use this approach in a Django view? |
| 23:31 | aebersold | Zalamander: Are there no restrictions by i.e. mod_python to spawn sub processes? |
| 23:43 | smitten_by_djang | magus: why is adding /usr/lib/python2.5/site-packages/django to python path wrong? |
| 23:44 | mattmcc | smitten_by_djang: Just like a system path lists directories which contain programs you can run from anywhere, a pythonpath contains paths that _contain_ python packages you can import. |
| 23:46 | smitten_by_djang | mattmcc: but isnt that needed since I am using/importing stuff from django inside my applications? |
| 23:46 | Magus- | of course not |
| 23:46 | Magus- | site-packages is already on pythonpath |
| 23:46 | Magus- | so the mere fact that django is in that folder makes it accessible |
| 23:47 | Magus- | if you actually have it as site-packages/django/django, then /that/ is wrong |
| 23:48 | mattmcc | smitten_by_djang: When you say 'from django import foo', 'django' isn't a directory on the pythonpath. If that were the case, you'd expect to see stuff like 'from site-packages import foo' as well, and hopefully that clearly doesn't make sense. |
| 23:50 | Wolfpaws | Hi! I have a minor problem with flatpages, and I have absolutely no idea, what's going on... I'm trying to edit a flatpage, and at save tie it says "App 'flatpages', model 'flatpage', not found". What gives? |
| 23:52 | Wolfpaws | Better yet; It looks it does that at every POST method |
| 23:53 | mattmcc | You have django.contrib.flatpages in your INSTALLED_APPS? |
| 23:54 | Wolfpaws | yesh. It works normally in the administration. It crashes when I want to save page. |
| 23:55 | zbyszek | ok , i don't want to make custom queryset nor manager. |
| 23:55 | smitten_by_djang | matmcc and magus: thanks a lot for the info! |
| 23:55 | zbyszek | but i would like to do stki like |
| 23:56 | zbyszek | extra(select table.field as field ) |
| 23:56 | mattmcc | Wolfpaws: If you run manage.py shell and do: "from django.db.models.loading import get_model; get_model('flatpages', 'flatpage')" does it return a class? |
| 23:56 | Wolfpaws | leme see... |
| 23:57 | mattmcc | zbyszek: extra has a tables argument. |
| 23:57 | Wolfpaws | mattmcc: Yep. <class 'django.contrib.flatpages.models.FlatPage'> |
| 23:57 | mattmcc | Huh. Because that error you quoted is only caused by get_model failing to fetch the model (Returning None) |
| 23:57 | zbyszek | i know mattmcc |
| 23:57 | zbyszek | but the thing is i want to make this generic |
| 23:57 | smitten_by_djang | magus: I made the changes in the apache file you suggested, but still the media is not accessible... my apache config is http://dpaste.com/37981/ |
| 23:58 | Magus- | smitten_by_djang: well you're kind of missing the actual map, like an Alias |
| 23:58 | Magus- | and DO NOT put your django source in a DocumentRoot |
| 23:58 | Magus- | django source should never, ever be present anywhere in a web reachable directory |
| 23:58 | Magus- | if your apache setup breaks, you could open up all your source code |
| 23:59 | dcode | is it possible to call permalink() on a tuple instead of using it as a decorator? when I try foo = permalink( (tuple, bar, bar) ) I get a reference to a function 'inner' |
| 23:59 | Zalamander | an alias shouldn't be necessary if the media directory actually exists |
| 23:59 | Magus- | dcode: of course not, decorators work on functions only :) |
| 23:59 | Wolfpaws | symlink is <3 |
| 23:59 | Magus- | dcode: however, you can use reverse() directly |
| 23:59 | dcode | woot |
| 23:59 | Zalamander | but you seem to know something about smitten's layout that I don't. I don't see anything that suggests that django source is in documentroot |
| 23:59 | dcode | thanks |
| 23:59 | FunkyBob | it'd have to be a really broken system to require you put PROGRAMS under DocRoot :) |
| 23:59 | Magus- | Zalamander: but he shouldn't have his docroot on his project dir |
| 23:59 | Magus- | Zalamander: um, look at the DocumentRoot line |
Page 20 of 20
← Previous
(1,997 total)