2008-8-26
| 22:11 | HenrikV | ah its the paginator stuff. It's quite odd code anyway, doesn't look like code that should be in Django |
| 22:11 | mattmcc | What, the paginator? |
| 22:11 | damonj | i'm not doing the looping, one of django's classes is... so i think there's something wrong with this: http://dpaste.com/74075/ , anyone have any leads? |
| 22:11 | HenrikV | the paginator property on Sitemap |
| 22:12 | par_ | hey guys, concerning template inheritance. If i have some base template, that needs to have header and content filled in, and then i have some content class/template (extending base template), how do i also get this content class to specify the header content |
| 22:12 | par_ | which is a different class, some header class |
| 22:12 | HenrikV | damonj, isn't it supposed to be register(Publisher,PublisherAdmin) ? |
| 22:12 | par_ | this is a basic question i know, i am just getting my project started |
| 22:12 | soyrex | HenrikV is right.... |
| 22:13 | mattmcc | Oh, heh. |
| 22:13 | mattmcc | Didn't even look that far down. |
| 22:13 | soyrex | hehe |
| 22:13 | soyrex | neither.. till he said it |
| 22:13 | damonj | hahahaha |
| 22:13 | damonj | thank you. |
| 22:13 | damonj removes crayon from nose. | |
| 22:13 | p-- | Ahh, 'WSGIReloadMechanism Process' in the apache config, then just touch the wsgi_handler.py script (or whatever you named it) |
| 22:14 | HenrikV | par_, you need to understand that Django templates are not as you might be used to, you don't include your header/footer templates, or do you already know that? |
| 22:14 | par_ | i didnt know that |
| 22:14 | par_ | how does the header/footer get provided then? |
| 22:14 | HenrikV | par_, there is a very good explanation in a podcast interview, want me to get you the link? |
| 22:14 | par_ | that would be wonderful |
| 22:15 | par_ | so then the header/footer must be contained in the base template? |
| 22:15 | soyrex | mattmcc: CACHE_MIDDLEWARE_KEY_PREFIX didn't help me |
| 22:15 | soyrex | i still get whacky keys in my memcache |
| 22:16 | mattmcc | par_: That's the philosophy behind inheritance-based templates, yeah. The base provides the 'shell' of the page |
| 22:16 | mattmcc | And marks blocks for child templates to fill in. |
| 22:16 | HenrikV | par_, you use extend and turn things on their head. Listen to the podcast at http://twit.tv/floss34, and have a look at how templates are organised at code.google.com/p/django-hotclub |
| 22:16 | mattmcc | soyrex: Oh, well you didn't mention an actual problem you were trying to solve, just for a way to manipulate how the keys are named.. :) |
| 22:16 | davidcramer | ANyone done anything with fire eagle |
| 22:16 | soyrex | mattmcc: i know.. |
| 22:17 | mattmcc | soyrex: And that's about it, without reimplementing the middleware. |
| 22:17 | soyrex | mattmcc: i want the key to JUST be something like domainname-/url/request/string |
| 22:17 | soyrex | mattmcc: wel.. that's good i guess... since i already wrote new middleware for it. |
| 22:17 | HenrikV | par_, I could explain it but it's better for you to get the full picture checkout out those two links |
| 22:17 | par_ | so what if my header contains logic, how does that get executed? |
| 22:17 | soyrex | seems stupid. Why would i want my server to talk to my fastcgi JUST to get the cached page out of cache.. |
| 22:18 | mattmcc | Maybe the right answer is an nginx plugin that can figure out the right cache key name. |
| 22:18 | HenrikV | par_, you structure your templates using class like {% extend %} and {% block %}s |
| 22:19 | soyrex | mattmcc: good luck getting nginx to generate this... "views.decorators.cache.cache_page./trekkingnepaltours-./.d41d8cd98f00b204e9800998ecf8427e" ;) |
| 22:19 | par_ | right, so i have some base which has {% block head %} ... and also a {% block content %} |
| 22:19 | HenrikV | par_, think deriving base classes and you get the picture |
| 22:20 | par_ | and then i got to http://mysite/contentPage |
| 22:20 | HenrikV | par_, the base templates flesh out the general structure, the specialised fill in the details by defining individual blocks |
| 22:20 | mattmcc | soyrex: It's a hash with predictable contents. |
| 22:20 | soyrex | mattmcc: i suppose. |
| 22:20 | soyrex | maybe i'll read the source ;) |
| 22:20 | mattmcc | And iirc they all come from the request object, so I don't see why it wouldn't be possible. |
| 22:20 | mattmcc | Check out django.utils.cache |
| 22:21 | mattmcc | _generate_cache_key |
| 22:21 | HenrikV | par_, the base template is where you do all your page layouting. It is expected to be different on all sites. Specialised templates on the other hand should not need to change much across sites, but rather be specific to application. |
| 22:22 | par_ | ok so in my base template, i can still have variables, etc, that get passed in by my content class? |
| 22:22 | mattmcc | Certainly. |
| 22:22 | par_ | shit ya :) |
| 22:22 | par_ | ok i think i am getting it |
| 22:23 | par_ | i'll get my hands dirty and i'm sure it'll clear up quick |
| 22:23 | par_ | thanks |
| 22:26 | HenrikV | par_, do yourself a favor and look through how things are structured in existing projects. It will teach you lots of template tricks |
| 22:28 | HenrikV | so Sitemaps was changed to fix a crashing bug with pagination, http://code.djangoproject.com/changeset/8231, very strange. I can't imagine it wasn't tested. |
| 22:36 | Pilzbauer | Hi, can i use more than just one memcached server when i store the user sessions in memcached? |
| 22:36 | Magus- | sure |
| 22:36 | Magus- | |
| 22:36 | mattmcc | That's part of the design of memcached. |
| 22:36 | Magus- | look at the clearly documented 2nd example :) |
| 22:37 | Pilzbauer | and how does django know where one cache key is stored? |
| 22:38 | beetle_b | Huvet, I'm sure you've lost interest by now, but not much had to be changed to implement your solution. I just created an admin method in the model that returned a queryset that had the admins of a given project - then I made it a property of that class. So stuff like project.admin.filter(...) continues to work. |
| 22:38 | beetle_b | Huvet, However, your solution does uglify the syntax in various places. Oh well. Can't win them all. |
| 22:39 | henbone | anyone else having trouble with the new comments system? I can't get render_comment_form or get_comment_form to work without errors |
| 22:40 | dgrant | I was just looking at the new comments doc but I don't see how to add it to my models? |
| 22:40 | ultraa1 | Could someone help me out with a tiny bit of template logic? What I am trying to do is see if the logged in user exists in a for loop. You can see the code here http://dpaste.com/74078/ |
| 22:42 | dgrant | I see...so there is no reference in the models. The comments table must have a foreign key to the Model that has comments, as well as a type field saying what model it is (so the primary key is a compound key) |
| 22:43 | dgrant | well forget that, each comment has an id most likely, I just mean it must have a column for the model that has the comment and an foreign key, and the combination is unique |
| 22:43 | dgrant | really cool! |
| 22:47 | sorl- | ultraa1: do you have user in your context? |
| 22:47 | ultraa1 | sorl-: ya |
| 22:48 | ultraa1 | sorl- it returns asdf twice |
| 22:48 | ultraa1 | sorl-: for both users registered |
| 22:49 | HenrikV | Does reopening this ticket make sense ? http://code.djangoproject.com/ticket/8020 |
| 22:49 | graham | Is there a way to create (perhaps a Manager) so that it will query all the rows in another table that refer to the current record? (Give me all the records in table a that point to record X in table b) |
| 22:50 | graham | I'd like this to be usable in the admin interface, should i simply make it a ManyToMany? |
| 22:51 | dgrant | graham: what are your models? |
| 22:51 | valiza1 | has something changed lately regarding signals ? |
| 22:52 | graham | dgrant: An easy example would be i have a Person table and a nicknames table, the nickname rows have a Fkey to a Person row, i would like to have something like (Person.nicknames) that would query the nicknames table for all rows that have an fkey to the Person row. Does that make sense? |
| 22:54 | samuel | guys, sorry about the silly question: how do I 'typecast' an object (days) to an integer in python? |
| 22:55 | graham | samuel: what kind of object is it? |
| 22:55 | samuel | datetime.timedelta to int |
| 22:55 | samuel | for strings its easy |
| 22:55 | samuel | but for datetimes? |
| 22:56 | graham | x = datetime.timedelta(2); x.days |
| 22:56 | graham | int(x.days) |
| 22:56 | samuel | oh, easy |
| 22:56 | samuel | thanks! |
| 22:56 | dgrant | graham: You should be able to do Person.nickname_set.all() |
| 22:57 | ViRUS | I want to center an image inside a quadratic div. I'm using sorl to resize it and assign it to a variable. Now I'm puzzled a bit how one can position the image inside the surrounding div correctly. it would be simple if I could just subtract from the image height from the box height and use that as half of the top-padding. (same for the left-right positioning) |
| 22:57 | dgrant | graham: I couldn't remember how to do it so ran ./manage.py shell which for me loaded up ipython (which has tab completion for python attributes/methods) |
| 22:58 | graham | dgrant: but how do i define it in the model. |
| 22:58 | Magus- | ViRUS: sounds like a css or js question, not a django question |
| 22:58 | dgrant | graham: I did (from blah.models import *) and then went to a Parent model and typed '.' then TAB |
| 22:58 | sorl- | ViRUS: table or make a custom processor |
| 22:58 | Magus- | graham: you don't define reverse relations |