Am 16.12.2007 um 18:09 schrieb yml:

>
> Hello,
> This exact situation happens to me sometimes ago and the root cause is
> that either you have an error in your urls.py or you are using the
> decorator "user_passes_test".

Never heard of this decorator therefore I suppose I don't use it. ;-)

>
> In order to solve the first one you should comments all the lines in
> urls.py and uncomment line after line. This is the the method I have
> used so far. If someone have a better one I would be happy to read it.

I've tried that. Stripped down the urls.py to the minimum but nothing  
changed.
This is my complete urls.py:

from django.conf.urls.defaults import *
from models import *

info_dict = { "queryset": BlogEntry.objects.all().order_by("- 
creationDate"), }

urlpatterns = patterns("",
     (r'^$', 'django.views.generic.list_detail.object_list',  
dict(info_dict, allow_empty=True, paginate_by=3)),
     (r'^page(?P<page>[0-9]+)/$',  
'django.views.generic.list_detail.object_list', dict(info_dict,  
allow_empty=True, paginate_by=3)),
     (r'^newComment/$',  
'django.views.generic.create_update.create_object',  
dict(model=BlogComment)),
     (r'^(?P<object_id>\d+)/$',  
'django.views.generic.list_detail.object_detail', dict(info_dict))
)

the part of the template that is called by list_detail.object_list:

<h3><a href="{{ entry.get_absolute_url }}"> {{ entry.title }}</a></h3>

is evaluated to:

<h3><a href=""> vierter eintrag</a></h3>

my code in the model:

        def get_absolute_url(self):
                return self.id

Anyone else got an idea? I would send anyone any code he requests...

Thanks!

Florian


>
> Regarding the second issue comment the line with the decorator, more
> details on that pb can be found there:
>  * http://code.djangoproject.com/ticket/5925
>
> I hope that help
>
> On 15 déc, 12:30, Florian Lindner <[EMAIL PROTECTED]> wrote:
>> Am 15.12.2007 um 05:03 schrieb Alex Koshelev:
>>
>>
>>
>>> 1) May be string is needed
>>
>> As I said, even when I return a constant string (return "foo") it
>> changing nothing.
>>
>>
>>
>>> 2) Absolute url not uri. So domain name is not needed.
>>
>>> On 15 дек, 01:29, Florian Lindner <[EMAIL PROTECTED]> wrote:
>>>> Hello,
>>>> I have two question regarding get_absolute_url:
>>
>>>> 1) I have the template code:
>>
>>>> {% for entry in object_list %}
>>>> <h3><a href="{{ entry.get_absolute_url }}"> {{ entry.title }}</a></
>>>> h3>
>>>> {% endfor %}
>>
>>>> It's called from a .generic.list_detail.object_list. My
>>>> get_absolute_url is implemented in my model:
>>
>>>> class BlogEntry(Model):
>>>>       def get_absolute_url(self):
>>>>               return self.id
>>
>>>> but the link in the template is alwayshttp://localhost:8000/blog/
>>>> where blog is my application name and which is also the URL used to
>>>> get to the template above. I can even return anything (like a
>>>> constant
>>>> string) but it's not being taken into account, the link is also the
>>>> same. What is wrong there?
>>
>>>> 2) As the name says get_absolute_url should always return a  
>>>> absolute
>>>> URL (which I understand is a complete URL). Is there a standard way
>>>> to
>>>> produce such a URL? For example I need to my server (here is
>>>> localhost:
>>>> 8000) and the path to application (blog/).
>>
>>>> Thanks,
>>
>>>> Florian
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to