2008-8-23
| 22:48 | putrycy | Magus-: I know... But I'm a bit confused... because it means that deactivating is't a certain way to prevent user from access... |
| 22:49 | putrycy | So how to achieve this? |
| 22:49 | Magus- | make your own mapping |
| 22:49 | Magus- | actually |
| 22:49 | Magus- | add a middleware |
| 22:49 | Magus- | put it after auth and session |
| 22:50 | Magus- | if request.user.is_authenticated() and not request.user.is_active(): logout(request, user) |
| 22:50 | Magus- | or something like that |
| 22:50 | Magus- | then redirect to index again |
| 22:50 | [530]_ | abdza: either use admin.autodiscover() or import the apps admin.py ore some other module that registers models manually in urls.py |
| 22:50 | [530]_ | or |
| 22:50 | Magus- | so if inactive user hits page, kick them out and log them out |
| 22:50 | putrycy | Magus: Thanks. I've thought about this way but I hoped there is any easier manner... |
| 22:52 | jgomo3 | Magus: my idia is that i can mannually take advantage of what the generic views of list a and list b generate with my browser, copy and paste the code of what i obtain in a text file and produce the "home page". I would like to use th direct_to_template generic view for the home page and in some way automate the mannually proccess i described. I was thinking in a tag like {% autorequest "list/a" %} wich is replaced by the text a browser would obtain doing th |
| 22:54 | Magus- | jgomo3: no, that is absolutely a HORRIBLE way of doing that |
| 22:54 | Magus- | views return a FULL WEBPAGE |
| 22:55 | Magus- | http response, <html>, <head>, EVERYTHING |
| 22:55 | Magus- | you can't just include them in pages |
| 22:55 | huimies | is it possible to configure serving static files as r'^(?P<path>.*)$' and still forward to some index page when entering site root url? |
| 22:55 | Magus- | read up on inclusion tags |
| 22:55 | Magus- | you render a template with data you query in the tag |
| 22:55 | abdza | [530]_: I still get a "The model is already registered error" even after moving all the admin parts (ie modeladmin class, admin.site.register) to app/admin.py. I use autodiscover in urls.py |
| 22:55 | Magus- | so you can make a tag that spits out a small div of what you want |
| 22:55 | jgomo3 | Magus: I use xml and xslt, so that is not an issue. I think that write a view that automate the proccess i described and don't use a generic view here is better than the view i have now which manipulate the models and generate the context. |
| 22:55 | Magus- | jgomo3: you DO NOT want any stupid autorequest thing |
| 22:55 | Magus- | please trust me, its a VERY VERY VERY BAD solution |
| 22:55 | SeJo | bryanveloso: if i use the simple direct to template, should i create a new urls.py?, as now all my other pages don't work claiming: Could not import django.views.generic.simple.auriege.pages.views |
| 22:56 | Magus- | learn how to write inclusion tags |
| 22:56 | Magus- | use them |
| 22:56 | Magus- | they are the proper fix |
| 22:56 | Magus- | they work well |
| 22:56 | Magus- | they're easy |
| 22:56 | jgomo3 | Magus: jajaja, i trust you |
| 22:56 | Haegin | evening all |
| 22:56 | SeJo | evening Haegin |
| 22:56 | Magus- | SeJo: you can't use the prefix on a patterns block that isn't all under that |
| 22:56 | Magus- | so stop putting something in the prefix that isn't supposed to be prefixed on every url |
| 22:56 | Haegin | is it possible to maek a ForeignKey optional? |
| 22:57 | SeJo | Magus-: so if i want my root page to be a simple page then i cannot? |
| 22:57 | Magus- | of course you can |
| 22:57 | SeJo | Magus-: or did i misunderstand you? |
| 22:57 | Magus- | just STOP misusing the prefix |
| 22:57 | Magus- | pastebin your urls.py |
| 22:58 | SeJo | Magus-: http://dpaste.com/73454/ |
| 22:58 | jgomo3 | Magus: i'll try the tag that produce what i want. You are telling me that i can write a tag that generate the same content i would obtained via the request whitout doing that request? |
| 22:59 | Magus- | SeJo: look at line 7 |
| 22:59 | Magus- | that view prefix is put on EVERY entry in the patterns() block |
| 22:59 | Magus- | but the other views ARE NOT in that prefix |
| 22:59 | Magus- | just change line 16 to be the full 'django.views.generic.simple.direct_to_template' |
| 22:59 | Magus- | instead of just 'direct_to_template' |
| 22:59 | SeJo | ach ok |
| 23:00 | Magus- | jgomo3: sort of - you don't want the full content |
| 23:00 | abdza | nvm.. it was because I was importing app/models.py at urls.py.. tq.. |
| 23:00 | Haegin | i have projects which have changes and threads and i want to link some of these threads to changes. Can i use changeid = models.ForeignKey(Thread, blank=True) to have an optional relationship with a change? |
| 23:01 | sorl_ | Haegin: also null=True |
| 23:01 | Haegin | sorl_: ok, thanks |
| 23:01 | sorl_ | and name it change, not changeid |
| 23:01 | Haegin | sorl_: yeah, course, my bad |
| 23:02 | Haegin | too use to old style databases |
| 23:02 | sorl_ | the field name will be name_id anyways |
| 23:02 | jgomo3 | Magus: I want the full content |
| 23:02 | sorl_ | (in the db) |
| 23:02 | sorl_ | i should say column |
| 23:03 | jgomo3 | Magus: i'm working with plain xml, so for me is convenient. I said the <div> thing just for explaining, but i'm generating simple xmls |
| 23:03 | bluebridge | Fun game, spot the regex error: (r'^(?<id>\d+)$', 'decks.view.show'), |
| 23:03 | Haegin | missed a P ? |
| 23:03 | Magus- | you forgot the P on ?P |
| 23:03 | bluebridge | doh |
| 23:04 | bluebridge | Haegin, Magus-: heh, thanks a lot |
| 23:04 | Haegin | yay, i can do regexps today :) |
| 23:25 | sorl_ | i have i python issue... how can: return self.changelist_view(request) call the super classes method? |
| 23:25 | sorl_ | i mean it does for a reason i have no clue |
| 23:25 | sorl_ | changelist_view is defined in the current class |
| 23:27 | theY4Kman | Hello, everybody |
| 23:27 | Haegin | hey theY4Kman |
| 23:27 | theY4Kman | I'm running Django off mod_wsgi in Apache2 |
| 23:28 | theY4Kman | Whenever I change my app and reload, nothing happens. However, if I wait ten seconds, the page changes. |
| 23:29 | theY4Kman | i haven't setup any caching on Django, so I've eliminated that, but I was hoping someone else has had this problem |
| 23:29 | theY4Kman | Google has provided me with nothing :( |
| 23:30 | Haegin | i was experiencing something similar with fast cgi on dreamhost |
| 23:31 | ravi | I am confused over OneToOne field, I am extending user profile. could not find better way |
| 23:32 | theY4Kman | Yeah, it seems to be mod_wsgi keeping it in memory, which makes the most sense |
| 23:32 | ra21vi | actually I am tryuing to create Profile extending the base Users from django |
| 23:34 | ra21vi | and some tutorials uses ForiegnKey and one uses OneToOneField.. somewhere in past I read that OneToONe is deprecated, not sure though where I Read, |
| 23:34 | ra21vi | please suggest what should I use |
| 23:35 | ra21vi | the base problem wth ForiegnKey is, it shows all users list as combo in admin page |
| 23:35 | yashh | Is there a way to find Model name from its object |
| 23:35 | rozwell | ra21vi: OneToOneField wasn't deprecated. The way it works was changed though. |
| 23:35 | paryl | can you not do things like list comprehensions in template tags? |
| 23:36 | ra21vi | rozwell: ok |
| 23:36 | paryl | i don't seem to have access to all of the object properties |
| 23:36 | Magus- | ra21vi: 1-1 was recommended against before, but the changes that were needed happened, so its fine to use now |
| 23:37 | Magus- | paryl: inside the python code of a tag, of course you can |
| 23:37 | Magus- | its python |
| 23:37 | ra21vi | rozwell: so It is now better to use OneToOne in creating extended Profile, because I dont want user to get list of all other uses in combo, and that field should be fixed , not editable by user (it makes sense) |
| 23:40 | paryl | Magus: I see that now... a typo on my part... but I keep running into weird things with template tags. i'm using direct_to_template in my urls.py and am returning Model.objects.all() for my template tag, but I'm not able to loop through the result |
| 23:40 | Magus- | not enough info |
| 23:40 | Magus- | use pastebin, show tag and template the tag is rendering |
| 23:41 | theY4Kman | yashh: Yes |
| 23:41 | yashh | hey |