Re: Problem with get_absolute_url()

2021-04-26 Thread Kelvin Sajere
: django-users@googlegroups.com > Subject: Re: Problem with get_absolute_url() > > In your URL pattern, just indicate that the audit URL pattern must first > go to “audit/{id}/”,and intro URL pattern to “intro/{id}/”. > > On Mon, Apr 26, 2021 at 03:49 Mike Dewhirst wrote: > >&

Re: Problem with get_absolute_url()

2021-04-26 Thread Mike Dewhirst
Many thanks Kelvin :-)M--(Unsigned mail from my phone) Original message From: Kelvin Sajere Date: 26/4/21 18:12 (GMT+10:00) To: django-users@googlegroups.com Subject: Re: Problem with get_absolute_url() In your URL pattern, just indicate that the audit URL pattern must first

Re: Problem with get_absolute_url()

2021-04-26 Thread Kelvin Sajere
In your URL pattern, just indicate that the audit URL pattern must first go to “audit/{id}/”,and intro URL pattern to “intro/{id}/”. On Mon, Apr 26, 2021 at 03:49 Mike Dewhirst wrote: > This code in the chemical model indicates that I'm trying to display two > different views of the same chemica

Re: Problem with get_absolute_url()

2021-04-26 Thread Kelvin Sajere
That's because both have the same path, and Django will always choose the one it sees first, in this case, the audit. Just change the path of any of the two will solve the problem. On Mon, Apr 26, 2021 at 03:49 Mike Dewhirst wrote: > This code in the chemical model indicates that I'm trying to d

Problem with get_absolute_url()

2021-04-26 Thread Mike Dewhirst
This code in the chemical model indicates that I'm trying to display two different views of the same chemical which has certain data in a details 1:1 record class Chemical(models.Model):     ...     def get_absolute_url(self):     detail = self.get_detail()     if detail and detail.rep

Re: Problem with get_absolute_url() in admin

2018-06-11 Thread Joakim Hove
Thank you; my main problem was with the sites model - and the default value for SITE_ID == 1. I had no intention of hardcoding the URL. On Mon, Jun 11, 2018 at 12:58 AM Anthony Anonde wrote: > the example.com is am example django give for Site. Which means there is > a way for you to manage mor

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Anthony Anonde
the example.com is am example django give for Site. Which means there is a way for you to manage more than one site at a time, basically using the site_id. To you Questions, i don't understand why you want to hard code your uri routing like that when you can easily use the app_name and name conv

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Joakim Hove
Thank you; that was indeed it! On Sunday, June 10, 2018 at 11:03:54 PM UTC+2, Melvyn Sopacua wrote: > > On zondag 10 juni 2018 22:54:10 CEST Joakim Hove wrote: > > > > It is the default hostname for django.contrib.sites > > > > > > < > https://github.com/django/django/blob/master/django/contri

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Melvyn Sopacua
On zondag 10 juni 2018 22:54:10 CEST Joakim Hove wrote: > > > It is the default hostname for django.contrib.sites > > > > > ent.py#L28> with SITE_ID = 1. > > OK - so that might be a smoking gun that I have not configured

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Joakim Hove
> > > > > It is the default hostname for django.contrib.sites > > > with SITE_ID = 1. > > OK - so that might be a smoking gun that I have not configured the "sites" model correctly? I have so far not reall

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Melvyn Sopacua
On zondag 10 juni 2018 13:30:51 CEST Joakim Hove wrote: > things do not work from the Admin. When I click on the "View on Site" link > i am redirected to "http://example.com/transaction/view/23635/"; and I get > an error message about failed XML parsing. I have no clue where the > "example.com" ad

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Joakim Hove
Thank you for answering; but I do not agree fully with your answer: 1. It is the @permalink decorator which is removed from Django 2.x - not the get_abolute_url() method. 2. I agree using the reverse in the get_absolute_url() is nicer, and I have also tried that - but the ersults were the same .

Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Gerald Brown
In version 2 of Django that function has been removed. For v 1.10 here is a link that might help: https://docs.djangoproject.com/en/1.10/ref/models/instances/#get-absolute-url Here is another link that might be of help: https://stackoverflow.com/questions/13503645/what-is-permalink-and-get-abs

Problem with get_absolute_url() in admin

2018-06-10 Thread Joakim Hove
Hello, I have a model `Transaction` which can be viewed at the url: /transaction/view/$ID/ - if I just enter that url in the browser, or in template everything works. But when I have the following get_abolute_url() method: def get_absolute_url(self): return "/transaction/view/{}/".format(

Re: problem with get_absolute_url()

2015-08-10 Thread Александр Мусаров
THANX A LOT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googleg

Re: problem with get_absolute_url()

2015-08-09 Thread James Schneider
For a 'catalog_product' URL, you need to provide two slug arguments, one for the category and one for the product. Your permalink function only provides a value for product_slug, which is why there is no match against the regex. You should also rewrite those functions to remove the @permalink deco

Re: problem with get_absolute_url()

2015-08-09 Thread Александр Мусаров
Changed the URLS as follows, doesn't seem to have helped much, still getting the same error.. url(r'^(?P[-\w]+)/$', views.category, name = 'catalog_category' ), url(r'^(?P[-\w]+)/(?P[-\w]+)/$', views.product, name = 'catalog_product'), суббота, 8 августа 2015 г., 0:03:40 UTC+3 пользоват

Re: problem with get_absolute_url()

2015-08-07 Thread James Schneider
You don't have a URL named 'catalog_product'. Check your URL's, it looks like you are passing an arg and a kwarg to the second pattern. -James On Aug 7, 2015 12:33 PM, "Александр Мусаров" wrote: > forgot to paste the model methods > > @models.permalink > def get_absolute_url(self): >

Re: problem with get_absolute_url()

2015-08-07 Thread Александр Мусаров
forgot to paste the model methods @models.permalink def get_absolute_url(self): return ('catalog_category', (), {'category_slug' : self.category_slug }) @models.permalink def get_absolute_url(self): return ('catalog_product', {}, {'product_slug': self.product_slug}) пя

problem with get_absolute_url()

2015-08-07 Thread Александр Мусаров
Hi, just wrapping my head around django, and trying to write an ecommerce store, when trying to pull out all products belonging to a category getting such an error NoReverseMatch at /catalog/smartphony/ Reverse for 'catalog_product' with arguments '()' and keyword arguments '{'product_slug':

Re: Problem with get_absolute_url

2011-11-17 Thread Jian Chang
yes, you need the decorator @models.permalink 2011/11/15 Rubén Dugo Martín > You forget the decorator: > > @models.permalink > def get_absolute_url(self): > return ('blog_post_detail', None, { >'year': self.publish.year, >'month': self.publish.strftime('%b').lower(), >

Re: Problem with get_absolute_url

2011-11-15 Thread Rubén Dugo Martín
You forget the decorator: @models.permalink def get_absolute_url(self): return ('blog_post_detail', None, { 'year': self.publish.year, 'month': self.publish.strftime('%b').lower(), 'day': self.publish.day, 'slug': self.slug }) 2011/11/15 Fredrik Grahn

Problem with get_absolute_url

2011-11-14 Thread Fredrik Grahn
Hello, I'm trying to get my head around some of the basics of Django and I've run into the strangest problem. Can't figure out what the problem is, the URL from my get_absolute_url() function in my model just refuses to turn into a proper URL. I'll post the code so hopefully it will be obvious for

Re: problem with get_absolute_url

2010-02-07 Thread Mike Ramirez
On Sunday 07 February 2010 10:49:03 jimgardener wrote: > Thanks Mike for the reply. > > I rewrote the method as > @models.permalink > def get_absolute_url(self): > return("myapp_entry_detail",(),{'id':self.id}) > > When I go to the admin interface's edit page for an entry and click > the view

Re: problem with get_absolute_url

2010-02-07 Thread jimgardener
Thanks Mike for the reply. I rewrote the method as @models.permalink def get_absolute_url(self): return("myapp_entry_detail",(),{'id':self.id}) When I go to the admin interface's edit page for an entry and click the viewsite button it causes the following error, NoReverseMatch,Reverse for 'm

Re: problem with get_absolute_url

2010-02-07 Thread Mike Ramirez
> Then what you should be returning is the reverse() args, which is the > viewname as a string, > This is wrong, it's the name parameter for the url in urls.py Sorry... Mike -- "One day I woke up and discovered that I was in love with tripe." -- Tom Anderson signature.asc Description: This

Re: problem with get_absolute_url

2010-02-07 Thread Mike Ramirez
On Sunday 07 February 2010 01:01:22 jimgardener wrote: > def get_absolute_url(self): > return ('myapp_entry_detail',[self.id]) > Try this @models.permalink def get_abosulte_url(self): return ("myapp_entry_detail", (), {'id': self.id}) --- @models.permalink is the dec

problem with get_absolute_url

2010-02-07 Thread jimgardener
hi I am new to django..and was trying out the permalink method I have defined a get_absolute_url for my Entry class and used permalink. class MyEntry(models.Model): pub_time=models.DateTimeField(default=datetime.now) mycategory=models.ForeignKey() def __unicode__(self):