Re: permalink decorator

2008-03-31 Thread Panos Laganakos
You're right Jonathan, that was it. Don't know why I left it there in the first place (no reason to match one or more char's for the slash `/?$` anyway). I hadn't noticed it since I was using the get_absolute_url in the templates. Thanks. On Mar 31, 2:51 pm, "Jonathan Buchanan" <[EMAIL PROTECT

Re: permalink decorator

2008-03-31 Thread Jonathan Buchanan
On Mon, Mar 31, 2008 at 12:35 PM, Panos Laganakos <[EMAIL PROTECTED]> wrote: > > I've switched my code from: > def get_absolute_url(self): > return '/store/products/%s' % self.slug > > to: > @models.permalink > def get_absolute_url(self): >

permalink decorator

2008-03-31 Thread Panos Laganakos
I've switched my code from: def get_absolute_url(self): return '/store/products/%s' % self.slug to: @models.permalink def get_absolute_url(self): return ('django.views.generic.list_detail.object_detail', (), { 'slug':

Re: how to access the permalink-decorator in the settings.py with a named url pattern?

2007-12-21 Thread Malcolm Tredinnick
On Fri, 2007-12-21 at 01:56 -0800, Julian wrote: > hi, > > i have a name url pattern: > > url( r'^login/', 'login', {'template_name': "config/templates/ > login.html"},name="config-login"), > > this works perfectly in the template for > > {% url config_login %} > > but wouldn't it hurt the d

how to access the permalink-decorator in the settings.py with a named url pattern?

2007-12-21 Thread Julian
hi, i have a name url pattern: url( r'^login/', 'login', {'template_name': "config/templates/ login.html"},name="config-login"), this works perfectly in the template for {% url config_login %} but wouldn't it hurt the dry principle to write the login-url in the settings.py? right, so i want t

Re: permalink decorator

2007-07-16 Thread Robert
On 16 Lip, 11:51, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Although you give the traceback, you don't say what exception is raised. > So it's hard to guess. > > A first step to debug this would be to try it at the interactive prompt > ("manage.py shell") and see what happens when you call >

Re: permalink decorator

2007-07-16 Thread Malcolm Tredinnick
On Mon, 2007-07-16 at 09:41 +, Robert wrote: > Hello, > > I would like to use the permalink decorator for get_absolute_url > method. > > Here's the code: > > There's a 'Post' model with 'created' -> models.DateTimeField() > fi

permalink decorator

2007-07-16 Thread Robert
Hello, I would like to use the permalink decorator for get_absolute_url method. Here's the code: There's a 'Post' model with 'created' -> models.DateTimeField() field.. (and others) @models.permalink get_absolute_url(sefl): return (post_

Re: Permalink decorator and generic views, revisited

2007-03-13 Thread dchandek
> I *think* that so long as you don't have multiple URLs pointing at the > same generic view you'll be OK, but otherwise there could be issues -- > we're working on it. Thanks for the reply. This is exactly the problem. I want to use object_detail and object_list for multiple URLs, so I'll be int

Re: Permalink decorator and generic views, revisited

2007-03-12 Thread James Bennett
On 3/12/07, dchandek <[EMAIL PROTECTED]> wrote: > Am I missing something? It's not that 'permalink' doesn't work with generic views -- it can. As I understand it, the problem is a URLConf like this: urlpatterns = patterns('django.views.generic.list_detail', (r'^foo/(?P\d+)/$', 'object_detail

Permalink decorator and generic views, revisited

2007-03-12 Thread dchandek
I posted previously about how it seemed to me that, while the permalink decorator is useful in decoupling the get_absolute_url() methods of an application's models from the site/project, it more or less forces you to create dummy custom views where you would normally simply use generic

Re: Permalink decorator and generic views

2007-03-09 Thread Malcolm Tredinnick
On Thu, 2007-03-08 at 08:57 -0800, dchandek wrote: > I was happy to find the addition of the permalink decorator in the > development version as a help in removing hardcoded paths from > get_absolute_url() methods. > > Unfortunately, using it requires that you define a custom view

Re: Permalink decorator and generic views

2007-03-09 Thread dchandek
> Any suggestion as to how we could differentiate amongst them? > > At thepermalinkdecoratorfinds the first match given the view and the > parameters. If there are multiple matches, we have to make a choice > somehow, right? Sadly, I don't have a suggestion. My point was merely that, while permal

Permalink decorator and generic views

2007-03-08 Thread dchandek
I was happy to find the addition of the permalink decorator in the development version as a help in removing hardcoded paths from get_absolute_url() methods. Unfortunately, using it requires that you define a custom view (even if the custom view simply returns a generic view). Interestingly, you

Re: permalink decorator is not working (at least for me)

2007-02-26 Thread Lawrence Oluyede
> I have a feeling somebody pointed this out in a ticket just recently, > too. We're treating something as a sequence when we shouldn't > necessarily be. I'll track it down this evening and either fix the docs > or the code. > > As an intermediate fix, pass in [str(self.id)] or (str(self.id),) and

Re: permalink decorator is not working (at least for me)

2007-02-25 Thread Malcolm Tredinnick
On Sun, 2007-02-25 at 20:55 +0100, Lawrence Oluyede wrote: > I tried to use the new permalink decorator to decouple the model from > the urlconf structure but it doesn't work correctly. Here's an > example: > > def get_absolute_url(self): > return "/

permalink decorator is not working (at least for me)

2007-02-25 Thread Lawrence Oluyede
I tried to use the new permalink decorator to decouple the model from the urlconf structure but it doesn't work correctly. Here's an example: def get_absolute_url(self): return "/foo/%d" % self.id changed to: def get_absolute_url(self): return ('