Re: object doesn't have get_absolute_url() methods
On Aug 15, 4:33 pm, Drasty <[EMAIL PROTECTED]> wrote: > Which actually works. Oh, you Django with your various appropriate > ways to call things! You would get a faster response here next time if you'd make your sample model more like the one that's giving you the problem :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: object doesn't have get_absolute_url() methods
Which actually works. Oh, you Django with your various appropriate ways to call things! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: object doesn't have get_absolute_url() methods
Aha! It has to do with #2. I get an AttributeError that leads me to think I'm asking the wrong question. So: Is there a way to call a field from a related ForeignKey for one of the attributes of get_absolute_url()? That is: class Thing(models.Model): slug = models.SlugField() class OtherThing(models.Model): thing = models.ForeignKey(Thing) slug = models.SlugField() def get_absolute_url(self): return '/%s/%s/' % (self.thing.slug, self.slug) On Aug 15, 2:42 pm, RajeshD <[EMAIL PROTECTED]> wrote: > I don't see anything wrong with what you have there. Try these: > > 1. Make sure the get_absolute_url method uses correct indentation (tab > vs. 4 spaces) consistent with the rest of your models.py > > 2. Drop into a shell with "python manage.py shell" and get an instance > of your model object. Then issue a direct obj.get_absolute_url() call > on it to see why it might be failing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: object doesn't have get_absolute_url() methods
I don't see anything wrong with what you have there. Try these: 1. Make sure the get_absolute_url method uses correct indentation (tab vs. 4 spaces) consistent with the rest of your models.py 2. Drop into a shell with "python manage.py shell" and get an instance of your model object. Then issue a direct obj.get_absolute_url() call on it to see why it might be failing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: object doesn't have get_absolute_url() methods
On Aug 15, 1:26 pm, RajeshD <[EMAIL PROTECTED]> wrote: > What error does it throw? Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/admin/r/7/1/ thing objects don't have get_absolute_url() methods -- I should note that I don't receive an error when I attempt to reach the URL outside the admin; but my templates don't give me an object's absolute URL, even when I call them in the template. All other requests to the object (e.g. {{ object.title }}) appear on the page, but {{ object.get_absolute_url }} comes up blank. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: object doesn't have get_absolute_url() methods
On Aug 15, 1:03 pm, Drasty <[EMAIL PROTECTED]> wrote: > I have a get_absolute_url() method on the object, but it doesn't > appear in the template, and the admin throws the error in the subject > line if I try to follow the "view on site" link. What error does it throw? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: object doesn't have get_absolute_url() methods
Additional information: I'm using the *latest* SVN version, checked out less than 2 minutes ago. In addition, I converted all of the varables in get_absolute_url() to the SlugField model, in an attempt to overcome any potential unicode hiccups. I still have the same problem--get_absolute_url() remains empty for the model. Help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
object doesn't have get_absolute_url() methods
I have a get_absolute_url() method on the object, but it doesn't appear in the template, and the admin throws the error in the subject line if I try to follow the "view on site" link. Here's a sample model: class Thing(models.Model): subject = models.CharField(maxlength=10) slug = models.SlugField(unique=True) def get_absolute_url(self): return '/thing/%s/%s/' % (self.subject, self.slug) The "view on site" link points to '/admin/r/1/7/' (not the abs url!), and my anchor tag is empty (), even thought I reference {{ object.get_absolute_url }} as the link. Help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---