[Answer]-Get_absolute_url stopped working?

1👍

Without urls.py I can only guess, but most likely it requires two digit month and day identifiers, while in some cases you provide only one digit. Anyway – that is the difference between your old and your new get_absolute_url code – in the old code month and day numbers where padded by 0 if necessary.

Try this:

def get_absolute_url(self):
    return reverse('blog-post', args=[
        self.publication_date.year, 
        self.publication_date.strftime('%m'), 
        self.publication_date.strftime('%d'), 
        self.URL
        ])

Leave a comment