Opened 9 years ago
Last modified 9 years ago
#27757 closed Bug
view_on_site does not receive the get_absolute_url returning uri — at Version 3
| Reported by: | George Tantiras | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | 1.10 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I am using Django-1.10.5 under Python-3.4.2.
from django.db import models
class Product(models.Model):
name = models.CharField(verbose_name="Name", max_length=100, unique=True)
def get_absolute_url(self):
return "test-string/{0}".format(self.id)
class Flavor(models.Model):
product = models.ForeignKey(Product, verbose_name="Product")
name = models.CharField(verbose_name="Name", max_length=100)
def get_absolute_url(self):
return "test-string-2/{0}".format(self.id)
admin.py:
from django.contrib import admin
from inline_online.models import Flavor, Product
class FlavorInline(admin.TabularInline):
model = Flavor
class ProductAdmin(admin.ModelAdmin):
list_display = ("id", "name")
inlines = [FlavorInline, ]
admin.site.register(Product, ProductAdmin)
class FlavorAdmin(admin.ModelAdmin):
view_on_site = True
admin.site.register(Flavor, FlavorAdmin)
The view_on_site link appears either in the main model admin view or in the inlines but the url is not the one returned from get_absolute_url method (example: /admin/r/10/1)
A very old ticket seem to reference the same issue: https://code.djangoproject.com/ticket/7984
Change History (3)
comment:1 by , 9 years ago
| Summary: | vIew_on_site is not working with inline models → view_on_site is not working with inline models |
|---|
comment:2 by , 9 years ago
| Description: | modified (diff) |
|---|---|
| Summary: | view_on_site is not working with inline models → view_on_site does not receive the get_absolute_url returning uri |
comment:3 by , 9 years ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.